First, after the source code compiled into a binary execution
.go code source file => go build => executable files (.exe file or a binary file linux) => Run Results
Second, the source code directly run
. 1 .go source file => go run => Run Results 2 compile the source code and the run (not generate a binary file)
Third, the difference between the two:
1 Use go build compiled binary program, it can be placed directly on a similar system to run directly, without go development environment 2 .go RUN run code on another and on, still need to go development environment will not operate 3 .go Build, compilers will depend on the program library file is packaged in an executable file, so the executable file size is slightly larger 4 .Windows go build environment command generated binary file name ends in .exe 5.Linux environment go build the same name generates a binary command
Four, Go Language Notes
. 1 .Go suffix codes are to .go 2 performs a function entry code is .Go main () function . 3 .Go strictly distinguish between sensitive language 4 end .Go code statement semicolon is not required, the compiler automatically recognize . 5 .Go Code compiled by row, row try to write only one statement 6 simplicity .Go language makes the code shall not contain unused variables, as well as unused package 7 .Go language by braces control codes 8. go fmt unified code style