Summary: How to Write Go Code
- The code organization follows repository -> module -> packages.
- Use
go mod init
and initialize module root as desired e.g.example.com/user/hello
- The Go binary goes to the path set in
GOBIN
- All imported modules are stored in
GOPATH/pkg/mod
subdirectory - The command
go clean -modcache
cleans downloaded packages.
Reference
Written with StackEdit.