Go workspace on Windows 10

If you are in the directory above gowebapp, then issue the command

 go build ./gowebapp

Note the relative syntax. This is because the go tool works on import path names, that is names relative to $GOPATH/src.

Another way to do what you want is to use the fully qualified import path of your package

go build github.com/dan-osineye/gowebapp

Lastly if you are inside $GOPATH/src/github.com/dan-osineye/gowebapp then you can issue

go build

Without supplying an import path to build the source code in the current directory.

You should also research the difference between go build and go install, go build is usually not the tool you want.

1 Like