I'm trying to download all of the dependencies of a project via go mod; the problem occurs when it comes to execute go mod vendor
on the CLI. The output is as follows:
go: finding github.com/hyperledger/fabric-sdk-go v0.0.0-00010101000000-000000000000
go: github.com/hyperledger/[email protected]: unknown revision 000000000000
go: error loading module requirements
The code that imports the libraries is this:
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 is the name of the package I'm working on:
go mod init krakengosdk
Any solution? I've been looking for any solution for a while, but I haven't came across anything useful.
EDIT: I've updated the go version to 1.13; it seems like the error has to be with "github.com/hyperledger/fabric-sdk-go/test/[email protected]":
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/[email protected] requires
github.com/hyperledger/[email protected]: invalid version: unknown revision 000000000000
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\n", cln, rsm, fbs)
}
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!