depエラーメモ
depを使って出たエラーをメモとして残しておく。
waiting for lockfile /go/pkg/dep/sm.lock: Locked by other process
waiting for lockfile /go/pkg/dep/sm.lock: Locked by other process
上記によれば、以下のコマンドで良い感じになると書いてあるが、うまくいかない。
$ rm $GOPATH/pkg/dep/sm.lock // => rm: /Users/〇〇/go/pkg/dep/sm.lock: No such file or directory
そんなファイルねえよとか言われるし・・・
そもそもother process
とか言われているこのprocessってどこだ。
まずこれはdocker-compose up
時のエラーだ。つまり、dockerコンテナ内のプロセスなのか?
だとしたらこうだ。
$ docker ps // まずは、起動しているコンテナを確かめる $ docker exec -ti コンテナID ash // bashは使えなかったので、ashを使う
プロセスがこのコンテナでのことを指しているなら、ここにgo/pkg/dep/sm.lock
があるのではないだろうか。
と探していたらあった。それを消してとりあえずこのエラーは解消。
grouped write of manifest, lock and vendor: error while writing out vendor tree: failed to write dep tree: failed to export github.com/lib/pq: cannot stat /go/pkg/dep/sources/https---github.com-lib-pq/.git/index: stat /go/pkg/dep/sources/https---github.com-lib-pq/.git/index: no such file or directory
とりあえず、上によると、以下のコマンドを打てば良いらしい。
$ dep ensure -update
dockerとローカルはマウントしているから、これは普通にローカルから打つ。とりあえずは、解消。
grouped write of manifest, lock and vendor: error while writing out vendor tree: failed to write dep tree: failed to export github.com/lib/pq: cannot stat /go/pkg/dep/sources/https---github.com-lib-pq/.git/index: stat /go/pkg/dep/sources/https---github.com-lib-pq/.git/index: no such file or directory
ネットが遅すぎたのが問題だったから速いの使えばOK。
以下試したことを書いておく。
上記と同じような事象かな。
まず、これがどこで起きているかというと、dockerで起きているはず。docker-compose up
で発生しているから。Dockerfileにgo get・・・ github/・・・
のようなことを書いているから、そこで起きているエラーだろう。ということは、dockerで設定を加えないといけない。
探していたら、以下の記事が似ている事象を扱っている。
とりあえず、Dockerfileに以下のように書いて再度docker-compose up
。
CMD git config --global url."git@github.com".insteadOf https://github.com/
そしたらこんなエラーが出やがる。ほう、やるやんか。
app_1 | grouped write of manifest, lock and vendor: error while writing out vendor tree: failed to write dep tree: failed to export github.com/gin-gonic/gin: failed to fetch source for https://github.com/gin-gonic/gin: unable to get repository: Cloning into '/go/pkg/dep/sources/https---github.com-gin--gonic-gin'... app_1 | fatal: unable to access 'https://github.com/gin-gonic/gin/': Could not resolve host: github.com app_1 | : command failed: [git clone --recursive -v --progress https://github.com/gin-gonic/gin /go/pkg/dep/sources/https---github.com-gin--gonic-gin]: exit status 128
docker-composeもう一回やると、パッケージ名変わるから諸々のパッケージgit cloneできていないっぽいな。
これは詰まる・・・ で、色々見ていたらこんな設定があるらしい。
$ git config --global --unset http.proxy $ git config --global --unset https.proxy
これをDockerfileに追加や・・・何とか動いた・・・ だが、しかしもう一回やると動かない。
うん?なんだこれは?ネット環境か・・・?今、ポケットwifiからやっていてかなりネット遅いしな・・・
次の日docker-compose up
したら普通にbuildできたわ・・・
以下の記述も消した。
CMD git config --global url."git@github.com".insteadOf https://github.com/ && git config --global --unset http.proxy && git config --global --unset https.proxy