官术网_书友最值得收藏!

pkg/

Go is a compiled programming language; we have the source code and code for the dependencies that we want to use in our project. In general, every time we build a binary, the compiler has to read the source code of our project and dependencies and then compile it to machine code. Compiling unchanged dependencies every time we compile our main program would lead to a very slow build process. This is the reason that object files exist; they allow us to compile dependencies into reusable machine code that can be readily included in our Go binary.

These object files are stored in $GOPATH/pkg; they follow a directory structure similar to that of src/, except that they are within a subdirectory. These directories tend to follow the naming pattern of <OS>_<CPU-Architecture>, because we can build executable binaries for multiple systems:

$ tree $GOPATH/pkg
pkg
└── linux_amd64
    ├── github.com
    │   ├── abbot
    │   │   └── go-http-auth.a
    │   ├── dimfeld
    │   │   └── httppath.a
    │   ├── oklog
    │   │   └── ulid.a
    │   ├── rcrowley
    │   │   └── go-metrics.a
    │   ├── sirupsen
    │   │   └── logrus.a
    │   ├── sony
    │   │   └── gobreaker.a
    └── golang.org
        └── x
            ├── crypto
            │   ├── bcrypt.a
            │   ├── blowfish.a
            │   └── ssh
            │       └── terminal.a
            ├── net
            │   └── context.a
            └── sys  
主站蜘蛛池模板: 合阳县| 九龙县| 五寨县| 韩城市| 张掖市| 黄冈市| 巍山| 西峡县| 浦江县| 深水埗区| 屏南县| 枝江市| 湘西| 万载县| 平罗县| 思南县| 长岛县| 耒阳市| 儋州市| 南漳县| 兴国县| 松阳县| 海阳市| 长阳| 黔江区| 甘南县| 舞阳县| 中阳县| 会宁县| 塔城市| 闻喜县| 洪江市| 东宁县| 黔东| 金阳县| 昭平县| 昌乐县| 五家渠市| 广南县| 遂溪县| 芮城县|