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

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  
主站蜘蛛池模板: 南木林县| 都江堰市| 中卫市| 满洲里市| 潮州市| 尖扎县| 三明市| 雅江县| 石嘴山市| 和平县| 于田县| 天峻县| 杭锦后旗| 当阳市| 卢氏县| 内黄县| 邵阳县| 望城县| 樟树市| 宁德市| 普陀区| 五台县| 万全县| 正宁县| 武川县| 特克斯县| 凉山| 易门县| 淮滨县| 大洼县| 花莲县| 遵义县| 神农架林区| 建湖县| 石家庄市| 邢台县| 定日县| 洪湖市| 依兰县| 海林市| 贺州市|