go vender 的环境搭建和使用

xiaoxiao2021-02-28  106

First

go get -u github.com/kardianos/govendor 编译 一个 govendor 

然后 添加到 path 环境变量

Quick Start

# 设置你的工程 cd "my project in GOPATH" govendor init # 加入存在的 GOPATH 文件到vendor. govendor add +external # 查看你的vendor 列表 govendor list # Look at what is using a package govendor list -v fmt #指明获取的版本 govendor fetch golang.org/x/net/context@a4bbce9fcae005b22ae5443f6af064d80a6f5a55 govendor fetch golang.org/x/net/context@v1 # Get latest v1.*.* tag or branch. govendor fetch golang.org/x/net/context@=v1 # Get the tag or branch named "v1". # 更新 govendor fetch golang.org/x/net/context # 格式化 govendor fmt +local #构建 govendor install +local # 测试 govendor test +local

Sub-commands

init Create the "vendor" folder and the "vendor.json" file. list List and filter existing dependencies and packages. add Add packages from $GOPATH. update Update packages from $GOPATH. remove Remove packages from the vendor folder. status Lists any packages missing, out-of-date, or modified locally. fetch Add new or update vendor folder packages from remote repository. sync Pull packages into vendor folder from remote repository with revisions from vendor.json file. migrate Move packages from a legacy tool to the vendor folder with metadata. get Like "go get" but copies dependencies into a "vendor" folder. license List discovered licenses for the given status or import paths. shell Run a "shell" to make multiple sub-commands more efficient for large projects. go tool commands that are wrapped: `+<status>` package selection may be used with them fmt, build, install, clean, test, vet, generate, tool

Status

Packages can be specified by their "status".

+local (l) packages in your project +external (e) referenced packages in GOPATH but not in current project +vendor (v) packages in the vendor folder +std (s) packages in the standard library +excluded (x) external packages explicitly excluded from vendoring +unused (u) packages in the vendor folder, but unused +missing (m) referenced packages but not found +program (p) package is a main package +outside +external +missing +all +all packages

Status can be referenced by their initial letters

转载请注明原文地址: https://www.6miu.com/read-69141.html

最新回复(0)