VoneChain-CS / fabric-sdk-go-gm

基于hyperledger/fabric-sdk-go v1.0.0-beta3进行国密改造
Apache License 2.0
7 stars 11 forks source link

go项目引用该包时编译出错 #2

Open ssy1997 opened 3 years ago

ssy1997 commented 3 years ago

how to solve: GOROOT=/usr/local/go1.14.4 #gosetup GOPATH=/home/xxx/go #gosetup /usr/local/go1.14.4/bin/go build -o /tmp/___go_build_fabcar fabcar #gosetup go: downloading github.com/VoneChain-CS/fabric-sdk-go-gm v1.0.0 go: downloading github.com/pkg/errors v0.8.1 go: downloading github.com/spf13/viper v1.7.1 go: downloading github.com/stretchr/testify v1.5.1 go: downloading github.com/cloudflare/cfssl v1.4.1 go: downloading google.golang.org/grpc v1.29.1 go: downloading github.com/tjfoc/gmtls v1.2.1 go: downloading golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d go: downloading github.com/tjfoc/gmsm v1.3.2 go: downloading github.com/spf13/jwalterweatherman v1.0.0 go: downloading github.com/hyperledger/fabric-protos-go v0.0.0-20200707132912-fee30f3ccd23 go: downloading github.com/golang/protobuf v1.3.3 go: downloading github.com/mitchellh/mapstructure v1.3.3 go: downloading golang.org/x/net v0.0.0-20200421231249-e086a090c8fd go: downloading github.com/spf13/pflag v1.0.3 go: downloading github.com/fsnotify/fsnotify v1.4.7 go: downloading github.com/hashicorp/hcl v1.0.0 go: downloading golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f go: downloading github.com/pelletier/go-toml v1.2.0 go: downloading gopkg.in/ini.v1 v1.51.0 go: downloading github.com/pmezard/go-difflib v1.0.0 go: downloading github.com/subosito/gotenv v1.2.0 go: downloading github.com/prometheus/client_golang v1.1.0 go: downloading github.com/spf13/afero v1.1.2 go: downloading github.com/hyperledger/fabric-lib-go v1.0.0 go: downloading github.com/golang/mock v1.4.3 go: downloading gopkg.in/yaml.v2 v2.3.0 go: downloading github.com/go-kit/kit v0.9.0 go: downloading github.com/spf13/cast v1.3.1 go: downloading github.com/prometheus/common v0.6.0 go: downloading golang.org/x/text v0.3.2 go: downloading github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 go: downloading google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215 go: downloading github.com/google/certificate-transparency-go v1.1.0 go: downloading github.com/magiconair/properties v1.8.1 go: downloading github.com/prometheus/procfs v0.0.5 go: downloading github.com/grantae/certinfo v0.0.0-20170412194111-59d56a35515b go: downloading github.com/davecgh/go-spew v1.1.1 go: downloading github.com/zmap/zlint v1.1.0 go: downloading github.com/go-logfmt/logfmt v0.4.0 go: downloading github.com/hyperledger/fabric-config v0.0.5 go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1 go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/Knetic/govaluate v3.0.0+incompatible go: downloading github.com/zmap/zcrypto v0.0.0-20191112190257-7f2fe6faf8cf go: downloading github.com/weppos/publicsuffix-go v0.5.0

github.com /VoneChain-CS/ fabric-sdk-go-gm/http ../../../../pkg/mod/github.com/!vone!chain-!c!s/fabric-sdk-go-gm@v1.0.0/http/server.go:1793:54: re.Conn undefined (type gmtls.RecordHeaderError has no field or method Conn) ../../../../pkg/mod/github.com/!vone!chain-!c!s/fabric-sdk-go-gm@v1.0.0/http/server.go:1794:22: re.Conn undefined (type gmtls.RecordHeaderError has no field or method Conn) ../../../../pkg/mod/github.com/!vone!chain-!c!s/fabric-sdk-go-gm@v1.0.0/http/server.go:1795:7: re.Conn undefined (type gmtls.RecordHeaderError has no field or method Conn)

Compilation finished with exit code 2

dddengyunjie commented 3 years ago

遇到了同样的问题,这是因为使用的是当前目录的下自己修改tjfoc/gmtls。看到go.mod文件里有replace github.com/tjfoc/gmtls v1.2.1 => ./tjfoc/gmtls,但好像没有效果,难道是要在工程的go.mod下也需要加上replace吗?如果你解决了也望分享

newsmys commented 3 years ago

对的,需要加replace,最好把replace的源码拷贝到项目中,当然还有其他办法,比如不用go mod管理

hjun007 commented 3 years ago

我go mod vendor把所有依赖放到vendor里面,然后关掉go mod,运行还是报一样的错

naonan commented 1 year ago

请问有解决方法了嘛?