Home  >  Article  >  Backend Development  >  When did the vendor come in in golang?

When did the vendor come in in golang?

(*-*)浩
(*-*)浩Original
2019-12-17 11:40:281911browse

When did the vendor come in in golang?

Golang official does not recommend the best package management solution. In the 1.5 version era, the official introduced the design of package management and added the vendor directory to support local package management dependencies.

The official wiki recommends a variety of package management tools that support this feature, such as: Godep, gv, gvt, glide, govendor, etc.

Even if using vendor, it must be in GOPATH.                                                                                                     (Recommended learning: go)

The order in which to find dependent package paths

The vendor directory under the current package.

Search in the upper directory until you find the vendor directory under src.

Look for dependent packages under GOPATH.

Look for the package management tool govendor in the GOROOT directory

You need to add $GOPATH/bin/ to PATH.

Installation

go get -u github.com/kardianos/govendor

Command

init     创建 vendor 文件夹和 vendor.json 文件
list     列出已经存在的依赖包
add      从 $GOPATH 中添加依赖包,会加到 vendor.json
update   从 $GOPATH 升级依赖包
remove   从 vendor 文件夹删除依赖
status   列出本地丢失的、过期的和修改的package
fetch   从远端库增加新的,或者更新 vendor 文件中的依赖包
sync     Pull packages into vendor folder from remote repository with revisions
migrate  Move packages from a legacy tool to the vendor folder with metadata.
get     类似 go get,但是会把依赖包拷贝到 vendor 目录
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

The above is the detailed content of When did the vendor come in in golang?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to copy golang sliceNext article:How to copy golang slice