golang package references

First, my GOPATH environment variable values ​​as shown below:

 

 

Second, following GOPATH src directory name of the directory below the path is a reference to the start position inside the package, as shown below:

 

 

 

 

 

 Third, the example: Here the same reference item packet, the source files "learn / main / main.go" reference package PrintIota methods "learn / lion" below. Here is learn src directory under the following directory GOPATH

 

 Fourth, if in accordance with the above method, you will not work, then that is GOPATH wrong path, or GOPATH by other third-party package management tools to the disabled, such as go.mod, vendor, etc., must use GOPATH to do in accordance with the above, I It is to be go.mod my GOPATH to disable out before there is a problem of error cited

 

Guess you like

Origin www.cnblogs.com/igoodful/p/11516927.html