3

I'm trying to run go build command for my project but it exits with below error.

alpha@GHOST-RIDER:~/GoWorkspace/src/github.com/hyperledger/firstproject$ go build
# github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations
../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)

Any help would be appreciated.

metadata
  • 1,139
  • 1
  • 7
  • 28

3 Answers3

4

As per code fabric is using the different version of this library: github.com/go-kit/kit/metrics/statsd. If you follow the System struct's statsd attribute, you can reach the reference on imports.

In master branch of this lib, SendLoop function requires 4 attributes, so that's the root cause. So this causes error when you compile on your local environment.

I had the same issue and worked around it by checking out a tag of library as below:

cd $GOPATH/src/github.com/go-kit/kit
git fetch --tags
git checkout v0.8.0
hsnkhrmn
  • 961
  • 7
  • 20
2

found a solution on the hyperledger-fabric-go-sdk group chat.

Add context.Background() in s.statsd.SendLoop like below

s.statsd.SendLoop(context.Background(), s.sendTicker.C, network, address)

in fabric-sdk-go/internal/github.com/hyperledger/fabric/core/operations/system.go file at line 227.

metadata
  • 1,139
  • 1
  • 7
  • 28
  • 1
    I think, editing the fabric source code must be avoided. – hsnkhrmn Apr 24 '19 at 14:50
  • 1
    Yep, but only that works correctly. Or, you need to change your fabric-sdk version (update it). But we are using fabric-sdk-go@v0.0.0-20190306235112-f198238ee7da now – Vladimir Dec 01 '20 at 09:16
1

I had a same issue, my solution worked and don't need edit fabric source code.

specify github.com/go-kit/kit to v0.8.0, modify go.mod:

replace github.com/go-kit/kit => github.com/go-kit/kit v0.8.0  // you specific version

require (
... ...

    // Maybe other version, go mod tidy update automatically, don't care it. 
    github.com/go-kit/kit v0.9.0 // indirect  

... ...
)

then it worked.