Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix hyperledger issue (undefined: discovery.ChaincodeCall) after updating go lang to 1.20? #260

Open
MrHIDEn opened this issue Mar 10, 2023 · 8 comments

Comments

@MrHIDEn
Copy link

MrHIDEn commented Mar 10, 2023

Hi.
I have workig fabric application based on 'Go lang' and 'fabric-sdk-go'.

I just updated it to newer versions of 'Go lang' but without success as library uses internally 'discovery' instead of 'peer'.

I'm using those packages:

github.com/hyperledger/fabric-contract-api-go v1.2.1
github.com/hyperledger/fabric-sdk-go v1.0.0

Errors:

# github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric/discovery/client
..\vendor\github.com\hyperledger\fabric-sdk-go\internal\github.com\hyperledger\fabric\discovery\client\api.go:47:38: undefined: discovery.ChaincodeCall
..\vendor\github.com\hyperledger\fabric-sdk-go\internal\github.com\hyperledger\fabric\discovery\client\client.go:83:63: undefined: discovery.ChaincodeInterest
..\vendor\github.com\hyperledger\fabric-sdk-go\internal\github.com\hyperledger\fabric\discovery\client\client.go:120:65: undefined: discovery.ChaincodeCall
..\vendor\github.com\hyperledger\fabric-sdk-go\internal\github.com\hyperledger\fabric\discovery\client\client.go:124:23: undefined: discovery.ChaincodeInterest
..\vendor\github.com\hyperledger\fabric-sdk-go\internal\github.com\hyperledger\fabric\discovery\client\client.go:229:105: undefined: discovery.ChaincodeCall
..\vendor\github.com\hyperledger\fabric-sdk-go\internal\github.com\hyperledger\fabric\discovery\client\client.go:247:64: undefined: discovery.ChaincodeCall

What should I do to fix that?

Regards

@MrRancy
Copy link

MrRancy commented Mar 16, 2023

Same error from me as well, is there a fix for this??

@MrHIDEn
Copy link
Author

MrHIDEn commented Mar 16, 2023

@MrRancy, I got error when I run tests. You too? I do not have solution yet. Sad.

@Teja-S
Copy link

Teja-S commented Mar 16, 2023

@MrHIDEn, I am using fabric-sdk-go in a personal package development, and that's when I got this error. don't know, because of this, I am unable to build my package. By the way, what is the version you are using? I am working on v1.20

@Teja-S
Copy link

Teja-S commented Mar 16, 2023

Hey @MrHIDEn, I got it working with these versions, for me, the error was from a different package which is the fabric-protos-go. Probably it's the same for you. Could you give it a try with this version?

go.mod file

go 1.20

require (
	github.com/hyperledger/fabric-lib-go v1.0.0 // indirect
	github.com/hyperledger/fabric-sdk-go v1.0.0 // indirect
	github.com/hyperledger/fabric v2.1.1+incompatible
	github.com/hyperledger/fabric-amcl v0.0.0-20221107192335-5c75bc7be9c0 // indirect
	github.com/hyperledger/fabric-config v0.1.0
	github.com/hyperledger/fabric-protos-go v0.0.0-20200707132912-fee30f3ccd23
)

@MrHIDEn
Copy link
Author

MrHIDEn commented Mar 16, 2023

Hey @Teja-S, Generali my app works on any Go version exept 1.14 but when I run tests I got error provided.
No for Go 1.20 I have below code

// go.mod file
go 1.20

require (
	github.com/codahale/sss v0.0.0-20160501174526-0cb9f6d3f7f1
	github.com/ghodss/yaml v1.0.0
	github.com/hyperledger/fabric-contract-api-go v1.2.1
	github.com/hyperledger/fabric-sdk-go v1.0.0
)

@MrHIDEn
Copy link
Author

MrHIDEn commented Mar 16, 2023

One of error says:

C:\Users\user\go\pkg\mod\github.com\hyperledger\fabric-sdk-go@v1.0.0\internal\github.com\hyperledger\fabric\discovery\client\api.go:47:38: undefined: discovery.ChaincodeCall

when I go there to ..\api.go:47:38 I see there is real issue:

	// Peers returns a response for a peer membership query, or error if something went wrong
	Peers(invocationChain ...*discovery.ChaincodeCall) ([]*Peer, error)

*discovery doesn't have ChaincodeCall at all !!

@MrHIDEn
Copy link
Author

MrHIDEn commented Mar 17, 2023

That is interested:
Github search: org:hyperledger Peers(invocationChain

Peers(invocationChain ...*peer.ChaincodeCall) ([]*Peer, error)

Peers(invocationChain ...*peer.ChaincodeCall) ([]*Peer, error)

On my libs installed
C:\Users\user\go\pkg\mod\github.com\hyperledger\fabric-sdk-go@v1.0.0\internal\github.com\hyperledger\fabric\discovery\client\api.go
Peers(invocationChain ...*discovery.ChaincodeCall) ([]*Peer, error)

@werniq
Copy link

werniq commented Oct 17, 2023

I also encountered this problem.
Issue was resolved in this way:

  1. Delete fabric-sdk-go in vendor directory
  2. Replace with new version: git clone https://github.com/hyperledger/fabric-sdk-go/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants