EC2にyumでepelリポジトリで追加したgoでdepをインストールしようとすると今現在エラーが出てできない。
$ sudo yum install -y golang
$ go get -u github.com/golang/dep/...
# github.com/golang/dep
..\github.com\golang\dep\lock.go:130: enc.SetIndent undefined (type *json.Encoder has no field or method SetIndent)
..\github.com\golang\dep\lock.go:131: enc.SetEscapeHTML undefined (type *json.Encoder has no field or method SetEscapeHTML)
..\github.com\golang\dep\manifest.go:129: enc.SetIndent undefined (type *json.Encoder has no field or method SetIndent)
..\github.com\golang\dep\manifest.go:130: enc.SetEscapeHTML undefined (type *json.Encoder has no field or method SetEscapeHTML)
このときインストールされているgoが1.6.3
となっている。
$ go version
go version go1.6.3 linux/amd64
depのissueによると1.7
以上でないといけないそうです。
https://github.com/golang/dep/issues/230
バージョン1.6.3
のGoを削除する。
$ sudo yum remove golang
バージョン1.7
のGoをインストールする。
$ cd /tmp
$ wget https://storage.googleapis.com/golang/go1.7.linux-amd64.tar.gz
$ tar -xvf go1.7.linux-amd64.tar.gz
$ mv go/ /usr/local/go/
$ echo "export GOPATH=${HOME}/.golang" >> ~/.bashrc
$ echo "export GOROOT=/usr/local/go" >> ~/.bashrc
$ echo "export PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> ~/.bashrc
$ . ~/.bashrc
goが1.7
以上になったことを確認。
$ go version
go version go1.7 linux/amd64
以上でインストールして使えるようになる。
$ mkdir -p $GOPATH/src/production
$ cd $GOPATH/src/production
$ git clone https://github.com/xxxxxxxxxx/xxxxxxxxxxxx.git .
$ go get -u github.com/golang/dep/...
$ dep init
$ dep ensure
参考
http://mattn.kaoriya.net/software/lang/go/20170125023240.htm
https://tecadmin.net/install-go-on-centos/