I encountered an error while installing Fabric CA with the go get command - go

when executing
go get -u github.com/hyperledger/fabric-ca/cmd/
I get the following error:
go get: installing executables with 'go get' in module mode is deprecated.
Use 'go install pkg#version' instead.
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
# github.com/hyperledger/fabric-ca/internal/pkg/util
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca#v1.5.2/internal/pkg/util/csp.go:117:12: undefined: bccsp.RSA2048KeyGenOpts
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca#v1.5.2/internal/pkg/util/csp.go:119:12: undefined: bccsp.RSA3072KeyGenOpts
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca#v1.5.2/internal/pkg/util/csp.go:121:12: undefined: bccsp.RSA4096KeyGenOpts
# github.com/hyperledger/fabric-ca/lib/server/operations
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca#v1.5.2/lib/server/operations/system.go:173:23: not enough arguments in call to s.statsd.SendLoop
have (<-chan time.Time, string, string)
want (context.Context, <-chan time.Time, string, string)
go version
go version go1.17.2 linux/amd64

go 1.17.2 isn't a supported version for fabric-ca 1.5.2 check the release notes for the supported version here https://github.com/hyperledger/fabric-ca/releases/tag/v1.5.2
however there is also an issue with a dependency that has changed an api such that using the -u option on go get means that it will download and use an incompatible version. This applies only to the server so for the server
go get github.com/hyperledger/fabric-ca/cmd/fabric-ca-server
should work, but you can also do
go get github.com/hyperledger/fabric-ca/cmd/...
to include a client build as well
You can of course just get official builds from https://github.com/hyperledger/fabric-ca/releases/tag/v1.5.2

Related

Go module installation error "undefined: any" [duplicate]

This question already has an answer here:
Why do I get "undeclared name: any (requires version go1.18 or later)" when using any instead of interface{}? I am using Go 1.18
(1 answer)
Closed 2 months ago.
I got the following error. Could anybody try the same command? I want to know whether it is a bug in the package or it is related to the version of go that I use or my setup.
$ go get github.com/gonejack/webarchive-to-html
# github.com/alecthomas/kong
../../../go/src/github.com/alecthomas/kong/callbacks.go:105:65: undefined: any
../../../go/src/github.com/alecthomas/kong/callbacks.go:124:15: undefined: any
../../../go/src/github.com/alecthomas/kong/context.go:723:27: undefined: any
../../../go/src/github.com/alecthomas/kong/options.go:59:8: undefined: any
../../../go/src/github.com/alecthomas/kong/options.go:66:18: undefined: any
$ echo $?
2
$ go version
go version go1.16 darwin/amd64
Let's see go.mod file of the package you trying to get. The package is written down based on 1.18 version of golang. So you need at least 1.18 version.
module github.com/gonejack/webarchive-to-html
go 1.18
...
Built-in type any is introduced in go 1.18. any is a simple alias for interface{}.
// builtin.go
type any = interface{}

Trouble with go get install for mcumgr

I am trying to install MCUMgr on MACos. Here is a link for mcumgr: https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html
I install the Go Programming Language and enter this command:
go install github.com/apache/mynewt-mcumgr-cli/mcumgr#latest
Upon doing this I get the following error:
go/pkg/mod/golang.org/x/sys#v0.0.0-20200223170610-d5e6a3e2c0ae/unix/zsyscall_darwin_amd64.go:28:3: //go:linkname must refer to declared function or variable
I then googled and found the following from stackoverflow: Go 1.18 build error on Mac: "unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable"
This gives me the following error:
go: golang.org/x/sys: unrecognized import path "golang.org/x": parse https://golang.org/x?go-get=1: no go-import meta tags ()
I am stuck right now on how to install MCUMgr for MACos and wondering if someone has previously had the same issues?
I used go 1.17 instead and used:
go get github.com/apache/mynewt-mcumgr-cli/mcumgr
Then into the bin folder where it is installed use sudo ./mcumgr to run.

go get fyne/io/driver/gl#v1.0.1 unrecognized import path

Trying to follow the installation guide here and most of the process is working. I'm having an issue with building it however.
When trying to build I'm getting this message:
C:...\gameboy.live>go build -o gbdotlive main.go
......\go\pkg\mod\fyne.io\fyne#v1.0.1\driver\gl\gl.go:20:2: missing go.sum entry for module providing package github.com/goki/freetype (imported by fyne.io/fyne/driver/gl); to add:
go get fyne.io/fyne/driver/gl#v1.0.1
Running the suggested command however raises another prompt:
C:...\gameboy.live>go get fyne.io/driver/gl#v1.0.1
go get fyne.io/driver/gl#v1.0.1: unrecognized import path "fyne.io/driver/gl": reading https://fyne.io/driver/gl?go-get=1: 404 Not Found
I've tried going for the version 1.4.3 driver too which raises a different error:
C:...\gameboy.live>go get fyne.io/fyne/gl#v1.4.3
go get: module fyne.io/fyne#v1.4.3 found, but does not contain package fyne.io/fyne/gl
Anybody familiar with this issue? FYI I'm on Windows and have MinGw installed already.
Just run go mod tidy before exec go build -o gbdotlive main.go.Have a try.

Not able to install fabric-sdk-go and its dependencies

I am trying to download fabric-sdk-go library and all its dependency with the below command in a linux VM.
go get -u github.com/hyperledger/fabric-sdk-go/...
It is giving the below error.
# github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations
../github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations/system.go:227:23: not enough arguments in call to s.statsd.SendLoop
have (<-chan time.Time, string, string)
want (context.Context, <-chan time.Time, string, string)
# github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util
../github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util/csp.go:47:8: cannot convert nil to type csr.KeyRequest
../github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util/csp.go:132:37: cannot use req.KeyRequest (type *csr.KeyRequest) as type csr.KeyRequest in argument to getBCCSPKeyOpts
Could this be because of go version mismatch or something? Here is the go version I am using the in linux VM.
go version go1.12.8 linux/amd64
If modules aren't turned on, go get will grab the incorrect version of some dependencies. As will most other dependency tools.
The first error # github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations is due to go-kit differences between v0.8.0 and v0.9.0.
The second error # github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/util is due to a more recent version of cfssl than supported.
The sdk doesn't have an actual binary output, so we shouldn't be go get'ting it in any case.

Install go package with dependencies

I had some issues with gopath configuration. I was able to resolve the go path issue. But getting this error...
[root#localhost mysqlbeat]# go get github.com/adibendahan/mysqlbeat
# github.com/adibendahan/mysqlbeat/beater
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:289:7: b.Events undefined (type *beat.Beat has no field or method Events)
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:303:7: b.Events undefined (type *beat.Beat has no field or method Events)
/root/go/src/src/github.com/adibendahan/mysqlbeat/beater/mysqlbeat.go:326:5: b.Events undefined (type *beat.Beat has no field or method Events)
How do I correctly install go package along with all it's dependencies?
Update:
I downloaded the package and tried to run it.Different error this time...
[root#localhost mysqlbeat]# make
go build
can't load package: /root/go/src/src/github.com/adibendahan/mysqlbeat/main.go:8:2: non-standard import "github.com/adibendahan/mysqlbeat/beater" in standard package "src/github.com/adibendahan/mysqlbeat"
make: *** [build] Error 1
Check out the How to Build section on README.md on mysqlbeat.
mysqlbeat uses Glide for dependency management. Check this for installing glide.
After installing Glide, clone the mysqlbeat repository and run:
$ glide update --no-recursive
$ make
If you still want to import this repository by go get, clone the repo and then run go get ./... from its root directory.

Resources