1. 程式人生 > >Hyperledger Fabric chaincode 開發(疑難解答)

Hyperledger Fabric chaincode 開發(疑難解答)

Q&A

Q1: 使用fabric release 1.2 進行golang chaincode開發時報錯:

..\..\hyperledger\fabric\vendor\github.com\docker\docker\pkg\archive\archive.go:364:5: hdr.Format undefined (type *tar.Header has no field or method Format)
..\..\hyperledger\fabric\vendor\github.com\docker\docker\pkg\archive\archive.go:364:15: undefined: tar.FormatPAX
..\..\hyperledger\fabric\vendor\github.com\docker\docker\pkg\archive\archive.go:1166:7: hdr.Format undefined (type *tar.Header has no field or method Format)
..\..\hyperledger\fabric\vendor\github.com\docker\docker\pkg\archive\archive.go:1166:17: undefined: tar.FormatPAX

A1: 這是因為在go 小於1.10的版本中自帶的tar package中 Header結構體中不包含 FormatPAX屬性,其解決方案如下:
1. 升級到1.10以上版本,但需要注意的是,在升級到1.10以上版本可能會遇到一些問題
2. 從官網下載 archive 包放在 fabric/vendor/ 資料夾下面。