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

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  
主站蜘蛛池模板: 大埔县| 团风县| 临泉县| 英超| 长治市| 当涂县| 庆元县| 武义县| 南安市| 石河子市| 武安市| 日土县| 武平县| 峨山| 武平县| 铜川市| 寿光市| 水富县| 莫力| 绥化市| 无棣县| 贵港市| 宁南县| 宜兰县| 喀喇沁旗| 织金县| 武汉市| 万盛区| 佳木斯市| 上犹县| 河津市| 西盟| 芜湖县| 金门县| 山阴县| 岱山县| 紫金县| 富源县| 繁峙县| 罗甸县| 长海县|