Skip to content

Commit

Permalink
[FAB-5663] fix import trouble with example paasthru
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lihangyu committed Oct 6, 2017
1 parent 8cdcd5e commit 540c7f4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/chaincode/go/passthru/passthru.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"
"strings"

"github.com/hyperledger/fabric/common/util"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
Expand All @@ -32,6 +31,14 @@ import (
type PassthruChaincode struct {
}

func toChaincodeArgs(args ...string) [][]byte {
bargs := make([][]byte, len(args))
for i, arg := range args {
bargs[i] = []byte(arg)
}
return bargs
}

//Init func will return error if function has string "error" anywhere
func (p *PassthruChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
function, _ := stub.GetFunctionAndParameters()
Expand All @@ -48,7 +55,7 @@ func (p *PassthruChaincode) iq(stub shim.ChaincodeStubInterface, function string
}
chaincodeID := function

return stub.InvokeChaincode(chaincodeID, util.ToChaincodeArgs(args...), "")
return stub.InvokeChaincode(chaincodeID, toChaincodeArgs(args...), "")
}

// Invoke passes through the invoke call
Expand Down

0 comments on commit 540c7f4

Please sign in to comment.