created: 2021-01-11T01:42:14.000Z

go get したものを消す

go clean で入れたものを消すことができる。

$ go clean -i -n github.com/sakamossan/mymy
cd /Users/sakamossan/go/src/github.com/sakamossan/mymy
rm -f mymy mymy.exe mymy.test mymy.test.exe main main.exe
rm -f /Users/sakamossan/go/bin/mymy

それぞれのフラグはこんな役割。

The -i flag causes clean to remove the corresponding installed archive or binary (what 'go install' would create).

The -n flag causes clean to print the remove commands it would execute, but not run them.

-n オプションはdryrunのような役割。 これを実行してから -i オプションだけで実行すれば安心。

$ go clean -i github.com/sakamossan/mymy

なお、$GOPATH 配下のソースは消してくれないのでそっちは自分で消す。

$ rm -rf $GOPATH/src/github.com/sakamossan/mymy

参考

入門 モダンLinux ―オンプレミスからクラウドまで、幅広い知識を会得する
[ad] 入門 モダンLinux ―オンプレミスからクラウドまで、幅広い知識を会得する
Michael Hausenblas, 武内 覚 (単行本(ソフトカバー))