dpfqy5976 2019-09-19 14:00 采纳率: 100%
浏览 4632
已采纳

go mod无法找到依赖项的版本v0.0.0-00010101000000-000000000000

我试图通过Go mod下载项目的所有依赖项;在CLI上执行Go mod供应商时会出现问题。产出如下:

go: finding github.com/hyperledger/fabric-sdk-go v0.0.0-00010101000000-000000000000
go: github.com/hyperledger/fabric-sdk-go@v0.0.0-00010101000000-000000000000: unknown revision 000000000000
go: error loading module requirements

导入库的代码如下:

import (    
    "github.com/hyperledger/fabric-sdk-go/pkg/client/ledger"
    "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
    "github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
)

krakengosdk是我正在处理的包的名称:

go mod init krakengosdk

有解决办法吗?我已经研究了一段时间,但没有发现任何有用的东西。

更新:我已经将Go版本更新为1.13;似乎错误必须与“github.com/hyperledger/fabric-sdk-go/test/integration@v0.0.0-20190918153951-5d7ae7a5be8f”:一起使用。

go get -v github.com/hyperledger/fabric-sdk-go/test/integration@latest
go: finding github.com/hyperledger/fabric-sdk-go/test/integration latest
go get: github.com/hyperledger/fabric-sdk-go/test/integration@v0.0.0-20190918153951-5d7ae7a5be8f requires
    github.com/hyperledger/fabric-sdk-go@v0.0.0-00010101000000-000000000000: invalid version: unknown revision 000000000000
  • 写回答

2条回答 默认 最新

  • duandao8607 2019-09-19 18:24
    关注

    Proposed diagnostics

    I suggest to try those commands in console (bash/dash/fish/zsh):

    
    # 1. Create clean project 
    $ mkdir /tmp/checkmods && cd /tmp/checkmods  # create clean directory
    $ export GO111MODULES=on
    $ go version # check that version 1.13
    $ go mod init main # name of package does not matter here
    
    # 2. Install packages, check output
    $ go get -v github.com/hyperledger/fabric-sdk-go/pkg/client/ledger
    $ go get -v github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt
    $ go get -v github.com/hyperledger/fabric-sdk-go/pkg/fabsdk
    
    # 3. Create main.go 
    $ touch main.go
    $ # edit main.go, add imported packages, import something from those packages
    $ go mod vendor 
    # Do you have problems here? 
    # if you encounter problems: 
    # - play around  with `go mod tidy`
    # - look at `go.mod` and `go.sum`
    # - `go mod graph/verify/why` - are your friends
    

    Example of main.go:

    package main
    
    import (
        "fmt"
        "github.com/hyperledger/fabric-sdk-go/pkg/client/ledger"
        "github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
        "github.com/hyperledger/fabric-sdk-go/pkg/fabsdk"
    )
    
    func main() {
        var (
            cln  &ledger.Client
            rsm  &resmgmt.Client
            fbs  &fabsdk.FabricSDK
        )
        fmt.Printf("%T %T %T
    ", cln, rsm, fbs)
    }
    

    Analysis

    If you encounter problems: explain on which line you encountered, what kind of problem.

    If everything OK with clean start: look what is different between your project and clean start (diffs for go.sum & go.mod)

    Good luck!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP