Where does go get install packages?

后端 未结 2 676
别跟我提以往
别跟我提以往 2020-12-29 20:29

I\'ve been given instructions to run go get which seems to succeed, but it\'s not clear to me where the package was installed to so

相关标签:
2条回答
  • 2020-12-29 20:39

    If you run go get and you already have the package it says nothing (even with the -v option). This is confusing if it's not in the first directory of your GOPATH. Ie you run go get , there is no error or any message but when you check the first directory of the GOPATH (which is where the doc says it should be) you can't find it.

    I eventually found it, but since I have a large GOPATH this was rather tedious.

    0 讨论(0)
  • 2020-12-29 20:52

    I found the missing clue by running brew info go, which says:

    ==> Caveats
    A valid GOPATH is required to use the `go get` command.
    If $GOPATH is not specified, $HOME/go will be used by default:
      https://golang.org/doc/code.html#GOPATH
    

    From that I found the executable in question at $HOME/go/bin.

    0 讨论(0)
提交回复
热议问题