- Learning GO - Jon Bodner
- go.mod files are like requirements.txt files
- Never edit go.mod directly, use
go get and go mod tidy
- Go modules have packages in them
- GO imports only whole packages (not individual functions etc)
go build creates an executable
- If a 3rd party library i’ve imported to use in my code moves host ( lets say github to gitlab) then what happens?
- Go dependency management was meant to be decentralised. So before v1.3 ish this would have broken any new boot up of the code. But after v1.3 there is now a global cache called the Go module proxy proxy.golang.org which caches the latest builds of libraries. This means as long as you don’t update your code it will keep working
- Why do we import from github directly?
- It points to the source code, and downloads it locally