Golang Project Structure [For Beginners]
This tutorial demonstrates on how to organize your Golang project structure in a specific way, so that you could develop a simple Go package and Go command on your own using go tool (Command go) later.
Go Project Structure
Keep all your Go code in a single workspace. A workspace directory looks like the following (screenshot from Visual Studio Code editor).
The above Golang project structure shows a workspace containing two git repositories (github.com/golang/example/, golang.org/x/image/), one command (hello.exe) and one library (stringUtil).
So a typical Go workspace contains many source repositories which contains many packages and commands.
GOPATH environment Variable
The GOPATH environment variable used to specify the location of your workspace (i.e., E:\Sneppets\goSampleWorkspace).
The command go env GOPATH prints the currect effective GOPATH
E:\Sneppets\goSampleWorkspace>go env GOPATH E:\Sneppets\goSampleWorkspace
Please ensure you download and install Go and set PATH environment variable. I had installed GO in the following path C:\Go\bin which is different than the project/workspace path and added this path value in the PATH environment variable.
References
https://golang.org