This is a creation in Article, where the information may have evolved or changed.
I. Overview
Golang updated the environment variables, resulting in a structural change of the entire goproject:
1[root@node175 goproject]# Tree-l22 .3 ├──bin4 │└──demo5 ├──pkg6 │└──linux_amd647 └──src8 ├──demo9 Ten 5Directories,1file One A Project source code under SRC, can contain multiple project:demo1, Demo2 and so on - at this time bin, pkg are empty directory; -CD src &&Go Install demo the #此时, the Lib file that generated the demo project is in the following directory -[root@node175 src]# LL.. /pkg/linux_amd64/demo/ -Total dosage4 --rw-r--r--1Root root914September - One: $LIB.A + -# At this point, the executable file is generated in the. /Bin directory: +[root@node175 src]# LL.. /bin/ ATotal dosage1620 at-rwxr-xr-x1Root root1654812September - One: -Demo
Why is the build goproject so laid out?
The answer is in the Go Env related configuration in the/etc/profile file;
1 export goroot=/root/xxx/go 2 export gopath=/root/xxx/goproject3 Export gobin=/root/xxx/goproject/4 export golib=/root/xxx/goproject/5