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条)

报告相同问题?

悬赏问题

  • ¥15 WebSocket的问题
  • ¥15 WebSocket的问题
  • ¥15 centos上启动kylin后网页报错404
  • ¥20 使用hackrf进行信号收发时接收到的信号幅度太小
  • ¥15 WebSocket的问题
  • ¥15 BDSBAS-B1C和B1C信号有什么不同
  • ¥15 在半圆平面内随机生成点坐标
  • ¥15 系统容量变化的几种多址方式TDMA, CDMA,FDMA,OFDMA 对比,应该给的是一个曲线 图,随着系统容量的增加,几种多址方式性能的对比 图,MATLAB程序仿真折线图
  • ¥15 用visual Studio 写c ++只运行上一个旧代码的运行结果是怎么回事
  • ¥15 系统容量变化的几种多址方式(TDMA,FDMA,OFDMA,CDMA)对比(相关搜索:曲线图)