我如何才能适当地供应商github.com/docker/docker?

此处是我的main.go </ p>

  package cmd 
\ nimport(
“上下文”
“ fmt”

“ github.com/docker/docker/api/types"
” github.com/docker/docker/client"

func main (){
cli,err:= client.NewClientWithOpts(client.WithVersion(“ 1.38”))
if err!= nil {
panic(err)
}

networks,err:= cli .NetworkList(context.Background(),类型。NetworkListOptions{})
如果错误!= nil {
panic(err)
}
fmt.Println(networks)
}
</ code> < / pre>

我尝试运行 dep init </ code>,但是供应商文件夹以较旧版本的docker / docker结尾,因为最新的标签是17.05,试图固定实际的提交,但是 </ p>

我也不给</ code> go mod供应商</ code>打了个招,但是那也依赖于git标签</ p>

docker / docker是moby / moby和docker / engine的别名。</ p>

任何人都可以向我解释并举例说明如何成功使用卖方机智 h docker API?</ p>
</ div>

展开原文

原文

here my main.go

package cmd

import (
    "context"
    "fmt"

    "github.com/docker/docker/api/types"
    "github.com/docker/docker/client"
)

func main() {
    cli, err := client.NewClientWithOpts(client.WithVersion("1.38"))
    if err != nil {
        panic(err)
    }

    networks, err := cli.NetworkList(context.Background(), types.NetworkListOptions{})
    if err != nil {
        panic(err)
    }
    fmt.Println(networks)
}

i tried to run dep init but vendor folder ended up with an older version of docker/docker because the newest tag is 17.05 tried to pin the actual commit but that did not work either

i give a shot to go mod vendor but that also rely on git tags

Strangely enough docker/docker is an alias to moby/moby and docker/engine.

Anyone could explain me and give example how can i successfully use vendoring with docker API?

dpd3447
dpd3447 您采取了什么步骤,然后又尝试将dep更新为“实际提交”?通常使用gitcommithash可以。您需要使用新的参考更新Gopkg.toml并按照此处说明运行depsure:golang.github.io/dep/docs/daily-dep.html
接近 2 年之前 回复

1个回答



  [[constraint]] 
name =“ github.com/docker/docker"
branch =” master“

[[override]]
name =“ github.com/docker/distribution"
branch =” master“
</ code> </ pre>

实际上这两个条目 帮助解决了 Gopkg.toml </ code>中的依赖项问题,然后运行 dep sure </ code> </ p>
</ div>

展开原文

原文

[[constraint]]
  name = "github.com/docker/docker"
  branch = "master"

[[override]]
  name = "github.com/docker/distribution"
  branch = "master"

Actually this two entries helped solve the dependency issue in Gopkg.toml, then running dep ensure

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问