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

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  
主站蜘蛛池模板: 姜堰市| 峨眉山市| 松原市| 镶黄旗| 河津市| 盐边县| 修水县| 望都县| 垫江县| 贵溪市| 湟中县| 陆良县| 桑植县| 马山县| 安仁县| 南部县| 武胜县| 郴州市| 连平县| 龙里县| 和静县| 叶城县| 灵武市| 天津市| 景东| 昭苏县| 历史| 德清县| 濉溪县| 阿拉善右旗| 巩义市| 通化县| 文成县| 扎兰屯市| 白朗县| 遂川县| 原平市| 灌阳县| 福安市| 花莲县| 淮南市|