dongshi6969
2018-09-09 18:18
浏览 278

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

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?

图片转代码服务由CSDN问答提供 功能建议

此处是我的main.go

  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)
} 
  <  / pre> 
 
 

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

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

docker / docker是moby / moby和docker / engine的别名。

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

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzhuang6247 2018-09-09 19:43
    已采纳
    [[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

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题