I modified the net package and I want to use the modified version in my application but it keeps using the old code.
As we have learned in Go installation tutorial, standard Go packages like located inside GOROOT directory (where Go is installed). Other project-level dependencies are stored inside GOPATH.
In Go, you manage dependencies as modules that contain the packages you import. This process is supported by: A decentralized system for publishing modules and retrieving their code. Developers make their modules available for other developers to use from their own repository and publish with a version number.
The go build command compiles the packages, along with their dependencies, but it doesn't install the results. The go install command compiles and installs the packages.
This works:
$ go install -a net
It wasn't rebuilding for me either, but the -a forces a rebuild even if the toolchain thinks the specified package is up to date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With