The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
Joker123456789

有一个 关于 go get 命令的问题

  •  
  •   Joker123456789 · Dec 9, 2021 · 3536 views
    This topic created in 1817 days ago, the information mentioned may be changed or developed.

    如果 我就写这么一句:

    go get github.com/xx/xxx

    他下载的是哪个分支,哪个 tag ?

    如果想下载 指定的 tag ,应该怎么写?

    7 replies  •  2021-12-15 16:37:51 +08:00
    Vegetable
    Vegetable
    Dec 9, 2021
    1
    默认应该是最新的 tag 、默认分支。指定的话 go get <path-to-repo>@<branch>
    branch 也可以是 hash
    basefas
    basefas
    Dec 9, 2021
    2
    可以看下 go help get
    go get example.com/pkg 是最新版本
    go get example.com/[email protected] 指定版本
    Joker123456789
    Joker123456789
    OP
    Dec 9, 2021
    3
    @Vegetable
    @basefas

    好的,非常感谢
    Reid
    Reid
    Dec 9, 2021
    4
    最新版本不是不建议使用 go get 用 Go install 吗
    cxsz
    cxsz
    Dec 9, 2021
    5
    @Reid 对滴,官方是这么建议的,不过一般用 ide 自动下载包,就不考虑这么多了
    XTTX
    XTTX
    Dec 15, 2021
    6
    因为 Go Modules versions ,go module 可不是默认最新版本哦! 默认 github.com/xx/v0 或者 github.com/xx/v1 , 然后会自动选择没有 module 里最后一个版本。
    XTTX
    XTTX
    Dec 15, 2021
    7
    import github.com/xx/ , 很多 lib 会出现上述情况。 libs 后加入 go modules 支持的,不再叫 github.com/xx/了, 叫 github.com/xx/vX ( v[版本号])
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1316 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 23:59 · PVG 07:59 · LAX 15:59 · JFK 18:59
    ♥ Do have faith in what you're doing.