go依赖管理 govendor使用

安装

go get -u github.com/kardianos/govendor

初始化vendor

#首先进入自己的项目,比如 项目是flame 目录在/home/flame/go/src/flame
cd /home/flame/go/src/flame
govendor init

会生成/home/flame/go/src/flame/vendor/vendor.json 文件

添加依赖

govendor add +e

vendor 文件夹下有依赖包

ls
#github.com  vendor.json

vendor/vendor.json 文件有依赖信息
如下

{
    "comment": "",
    "ignore": "test",
    "package": [
        {
            "checksumSHA1": "wmiJbuFVCxg22zwXIeLsVCudyeY=",
            "path": "github.com/go-sql-driver/mysql",
            "revision": "c45f530f8e7fe40f4687eaa50d0c8c5f1b66f9e0",
            "revisionTime": "2018-12-18T12:36:37Z"
        },
        {
            "checksumSHA1": "GWZt8djqK/GoHgon8POT508+BXM=",
            "path": "github.com/jinzhu/gorm",
            "revision": "5ad6f621e6f59672f5b5061df85b243436fde048",
            "revisionTime": "2018-12-13T13:04:51Z"
        },
        {
            "checksumSHA1": "eECxSkwh0WmhLwaxHfkvcLOWS08=",
            "path": "github.com/jinzhu/gorm/dialects/mysql",
            "revision": "5ad6f621e6f59672f5b5061df85b243436fde048",
            "revisionTime": "2018-12-13T13:04:51Z"
        },
        {
            "checksumSHA1": "4eelJOSLZoDzLuaJvgilOBVNovU=",
            "path": "github.com/jinzhu/inflection",
            "revision": "04140366298a54a039076d798123ffa108fff46c",
            "revisionTime": "2018-03-08T03:36:59Z"
        }
    ],
    "rootPath": "flame"
}
    原文作者:flamefatex
    原文地址: https://segmentfault.com/a/1190000017894151
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞