After upgrading from Go 1.2.1 to 1.3 (Windows 7 64 bit) \"go build\" execution time has increased from around 4 to over 45 seconds. There were no other changes except the go ver
You probably have dependencies that are being recompiled each time. Try go install -a mypackage
to rebuild all dependencies.
Removing $GOPATH/pkg
also helps to ensure you don't have old object files around.
Building with the -x
flag will show you if the toolchain is finding incompatible versions.
I have the exact same problem, running this command solves it:
go get -u -v github.com/mattn/go-sqlite3
Another tip: http://kokizzu.blogspot.co.id/2016/06/solution-for-golang-slow-compile.html
If you try as all other said but still not work, I suggest removing the directory of $GOPATH
such as :
sudo rm -rf $GOPATH
cd yourproject
go get -d
go get -u -v github.com/mattn/go-sqlite3
You can build sqlite3 like this:
cd ./vendor/github.com/mattn/go-sqlite3/
go install
After that your project will b built much faster.
Using go1.6,
Simply run go build -i
.
It will compile all the dependencies and store them at $GOPATH/pkg/*/*
as .a files.
Later when you run go run main.go
, everything is much faster.
What s really great is that if you use vendored dependencies (IE: a vendor folder in your project), deps are built appropriately within $GOPATH/pkg/**/yourproject/vendor/**
So you don t have to go get install/get/whatever
and have a mix of vendor / global dependencies.
I suspect you got to re-build .a files after deps update (glide update or smthg like this), but i did not test that yet.
I just experienced the same problem - updating from 1.4 to 1.5. It seems that the olds versions are somehow incompatible or are being rebuild every time as go build -x
shows. Executing go get -v
invalidates all packages or refetches them, I am not quite sure and go build -x
shows quite less output.