0、参考
https://www.ibm.com/developerworks/cn/cloud/library/cl-ibm-blockchain-chaincode-development
-using-golang/index.html
1、先写一个hello.go
文件位于cd $GOPATH/src
即 /Users/frank/go/src/hello.go
fabric资源在$GOPATH/src/github.com/hyperledger
import "fmt"
import "github.com/hyperledger/fabric/core/chaincode/shim"
func main() {
fmt.Println("hello world . 你好 世界!")
}
这里遇到import shime文件报错
go build github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11: invalid flag in #cgo LDFLAGS:
-I/usr/local/share/libtool
解决办法:
https://stackoverflow.com/questions/49062730/invalid-flag-cgo-ldflags-break-build-with-go-lang
remove '/usr/local/share/libtool' from github.com/miekg/pkcs11 HEAD and then build successfully.
找到pkcs11.go文件,打开后搜索'/usr/local/share/libtool',发现有两行注释中包含,删除后可以编辑通过!
fabric hello world by mac
最新推荐文章于 2022-03-12 17:20:04 发布