can not build an example program in golang workspace


I’m trying to use golang workspace to manage my golang project, but there’s a very strange problem that I can not get one module with specific name (example/apps/albireo) built with error: package example/apps/albireo is not in GOROOT.

I have my test code submitted in, and here’s the project structure:

apps  Makefile

albi  albireo  albireo1  gliese

go.mod  main.go

go.mod  main.go

go.mod  main.go

go.mod  main.go

Each module has only one simple main func inside, but when I try to build the modules, only the example/apps/albireo was failed:

> make
Building gliese ...
Building albi ...
Building albireo1 ...
Building albireo ...
package example/apps/albireo is not in GOROOT (/opt/go/src/example/apps/albireo)
make: *** [Makefile:7: albireo] Error 1

And I’m using go1.8.3 under linux.



It’s a typo in your go.mod file inside of albireo folder. It should be:

module example/apps/albireo

instead of

module example/apps/albiero

Answered By – Endre Simo

Answer Checked By – David Marino (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.