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

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

  •  
  •   Joker123456789 · Dec 9, 2021 · 2944 views
    This topic created in 1649 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
        1
    Vegetable  
       Dec 9, 2021
    默认应该是最新的 tag 、默认分支。指定的话 go get <path-to-repo>@<branch>
    branch 也可以是 hash
    basefas
        2
    basefas  
       Dec 9, 2021
    可以看下 go help get
    go get example.com/pkg 是最新版本
    go get example.com/[email protected] 指定版本
    Joker123456789
        3
    Joker123456789  
    OP
       Dec 9, 2021
    @Vegetable
    @basefas

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