Cannot add new service?

Hi - I’m having trouble adding a new service to my app.
I’ve created a new folder called newservice and have copied the hello world example code and updated the filename to newservice.go and the encore:api definition to //encore:api public path=/newservice/:name.

However when I run the app I get the following error, which doesn’t really help me much:

❌ Compiling application source code... Failed: __encore/main/main.go:5:2: found packages newservice (encore_internal__service.go) and hello (newservice_test.go) in /Users/username/micro/newservice

Any advice?

Hey WindowMaker, sorry to hear you’re having trouble!

From the error message it sounds like the newservice directory has files with two different package names, newservice (in newservice.go) and hello (in newservice_test.go). In Go all files in the same package need to have the same package name.

If you update newservice_test.go to say package newservice at the top it should work.

1 Like

Thanks @andre - that worked!
Sorry for making such a silly mistake.

No worries at all, glad to hear it works now!