Typically a gopath looks like this: (I have added random projects to it to demonstrate what it could look like)
(通常,gopath看起来像这样:(我在其中添加了随机项目以演示它的外观))
- gopath
(gopath)
- src
(src)
- pkg
(包)
- bin
(箱子)
Your $GOPATH$ enviroment variable should point to that root folder which contains src, pkg and bin.
(您的$ GOPATH $环境变量应指向包含src,pkg和bin的根文件夹。)
So when you go get a package from github for example it'l be put in the github.com src folder, and that's when you'll be able to use that library in your own projects.
(因此,例如,当您从github 获取软件包时,它将被放在github.com src文件夹中,这样您就可以在自己的项目中使用该库了。)
Usage Example
(使用范例)
So for example, if I need the fluffle/goirc library from github, I'l type:
(因此,例如,如果我需要来自github的fluffle / goirc库,请输入:)
go get github.com/fluffle/goirc
The library will then be placed in:
(然后将库放置在:)
gopath/src/github.com
And I can use the library by importing it with:
(我可以通过以下方式导入该库:)
import (
"github.com/fluffle/goirc/client"
)
And then use it
(然后用)
client.NewConfig("My User Name")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…