This is a creation in Article, where the information may have evolved or changed.
Golang Introduction and one of the series of stepping pits
Compiling articles
All along, I think Golang is very likes.
It avoids the gofmt of Java/C + + braces in the end of a row or another line of the dead argument, frankly provide a quiet, let everyone shut up quietly write code.
It eliminates the possibility of binary publishing, and all of your vendor must have source code and then compile together. Even the default support for a tool called go get, the goods directly with github,bitbucket such as repo hoster communication, the code from the Internet to take down.
Are we all happy?
Happy! Because everyone's code GOFMT after the same length, easier to read.
Happy! Because all references are source code, we can read, can be developed two times.
But I, not happy! (Which garlic do you count?) Hell, you're going to die! )
I'm really not happy.
Write a thousands of line of code, the compilation speed can endure. When your code comes to a certain amount of code, you're not too happy. Compilation is the turtle speed Ah!
$ time go buildgo build 3.46s user 0.64s system 122% cpu 3.334 total
You can imagine in vim to execute a:! Gobuild the entire editor stuck 3 seconds of embarrassment?
Those pains! Those struggles!
After a bitter lesson, I finally got this thing:
$ alias | grep build gobuild='go install'
The result is:
$ time gobuildgo install 0.62s user 0.25s system 128% cpu 0.675 total
Is it magical?
In fact, the first go install is very slow, but the second time is incremental build, time consumption is basically linking, so it becomes easier to endure some.
Don't get excited, do you have any side effects?
$ gobuildgo install: no install location for directory /Users/zhchang/work/shit outside GOPATH For more details see: 'go help gopath'
The side effect is that the trick can only be used in Gopath.
Two side effects, go build will generate a build out of the current directory Binary,go install will throw binary into the $GOPATH/bin/below
To sum up, if you are the same as me, a man of the wind, completely unable to tolerate the IDE can't keep up with the pain of the finger, completely unbearable vim by go build slow, please try go install.