takaya030の備忘録

PHP、Laravel、Docker などの話がメインです

MSYS2 の golang 環境に dep をインストール

検証環境

Windows10 Home Edition

msys2-x86_64-20170918

$ go version
go version go1.9.1 windows/amd64

dep とは

glide に代わる golang のパッケージ管理ツール
github.com

dep のインストール

以下のコマンドで $GOPATH/bindep.exe がインストールされる

$ go get -u github.com/golang/dep/cmd/dep

$GOPATH/bin にパスを通す

.bashrc などに下記の設定を追加しておく

export PATH=$GOPATH/bin:$PATH

動作確認

$ dep --help
Dep is a tool for managing dependencies for Go projects

Usage: "dep [command]"

Commands:

  init     Set up a new Go project, or migrate an existing one
  status   Report the status of the project's dependencies
  ensure   Ensure a dependency is safely vendored in the project
  prune    Pruning is now performed automatically by dep ensure.
  version  Show the dep version information

Examples:
  dep init                               set up a new project
  dep ensure                             install the project's dependencies
  dep ensure -update                     update the locked versions of all dependencies
  dep ensure -add github.com/pkg/errors  add a dependency to the project

Use "dep help [command]" for more information about a command.

参考サイト

qiita.com
qiita.com