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

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  
主站蜘蛛池模板: 四会市| 沙洋县| 鲁甸县| 平乡县| 江油市| 呼和浩特市| 栖霞市| 北川| 芜湖市| 陆河县| 玉门市| 泰安市| 抚宁县| 马龙县| 平谷区| 海宁市| 新田县| 泾源县| 大兴区| 密云县| 怀仁县| 大洼县| 咸丰县| 龙陵县| 岳池县| 哈巴河县| 乌拉特前旗| 德昌县| 新乐市| 稷山县| 和林格尔县| 台中市| 大渡口区| 威远县| 兴文县| 县级市| 通辽市| 游戏| 寻甸| 永德县| 合作市|