Skip to content

Commit 540c7f4

Browse files
committed
[FAB-5663] fix import trouble with example paasthru
This is same fix as example04 and example05. It removed "util" import to avoid error of "use of vendored package not allowed". Change-Id: I6a3b006afa666f24148b46b4054db2ce4fa91a9e Signed-off-by: Hangyu Li <li.hangyu@jp.fujitsu.com>
1 parent 8cdcd5e commit 540c7f4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

examples/chaincode/go/passthru/passthru.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121
"strings"
2222

23-
"github.com/hyperledger/fabric/common/util"
2423
"github.com/hyperledger/fabric/core/chaincode/shim"
2524
pb "github.com/hyperledger/fabric/protos/peer"
2625
)
@@ -32,6 +31,14 @@ import (
3231
type PassthruChaincode struct {
3332
}
3433

34+
func toChaincodeArgs(args ...string) [][]byte {
35+
bargs := make([][]byte, len(args))
36+
for i, arg := range args {
37+
bargs[i] = []byte(arg)
38+
}
39+
return bargs
40+
}
41+
3542
//Init func will return error if function has string "error" anywhere
3643
func (p *PassthruChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
3744
function, _ := stub.GetFunctionAndParameters()
@@ -48,7 +55,7 @@ func (p *PassthruChaincode) iq(stub shim.ChaincodeStubInterface, function string
4855
}
4956
chaincodeID := function
5057

51-
return stub.InvokeChaincode(chaincodeID, util.ToChaincodeArgs(args...), "")
58+
return stub.InvokeChaincode(chaincodeID, toChaincodeArgs(args...), "")
5259
}
5360

5461
// Invoke passes through the invoke call

0 commit comments

Comments
 (0)