Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rebuild native Golang packages after I modify them?

Tags:

go

I modified the net package and I want to use the modified version in my application but it keeps using the old code.

like image 604
devinov Avatar asked Jun 30 '16 16:06

devinov


People also ask

Where are Go dependencies installed?

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.

Does Go have a package manager?

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.

Does Go build install dependencies?

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.


1 Answers

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.

like image 69
elimisteve Avatar answered Oct 06 '22 01:10

elimisteve