Skip to content

Commit 1f5e832

Browse files
committed
Fix unused variable error
Change-Id: Ibfcbd0a3543f9e20fa05677b0bb32e6d353cb3bd Signed-off-by: Gabor Hosszu <[email protected]>
1 parent 294af0d commit 1f5e832

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

examples/chaincode/go/asset_management/asset_management.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type AssetManagementChaincode struct {
3939
// Init method will be called during deployment.
4040
// The deploy transaction metadata is supposed to contain the administrator cert
4141
func (t *AssetManagementChaincode) Init(stub shim.ChaincodeStubInterface) ([]byte, error) {
42-
function, args := stub.GetFunctionAndParameters()
42+
_, args := stub.GetFunctionAndParameters()
4343
myLogger.Debug("Init Chaincode...")
4444
if len(args) != 0 {
4545
return nil, errors.New("Incorrect number of arguments. Expecting 0")

examples/chaincode/go/asset_management_with_roles/asset_management_with_roles.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type AssetManagementChaincode struct {
5858

5959
// Init initialization
6060
func (t *AssetManagementChaincode) Init(stub shim.ChaincodeStubInterface) ([]byte, error) {
61-
function, args := stub.GetFunctionAndParameters()
61+
_, args := stub.GetFunctionAndParameters()
6262
myLogger.Info("[AssetManagementChaincode] Init")
6363
if len(args) != 0 {
6464
return nil, errors.New("Incorrect number of arguments. Expecting 0")

examples/chaincode/go/asset_management_with_roles/asset_management_with_roles_test.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"time"
2424

2525
"encoding/base64"
26-
"io/ioutil"
2726
"os"
2827
"path/filepath"
2928

@@ -33,6 +32,7 @@ import (
3332
"github.com/hyperledger/fabric/core/container"
3433
"github.com/hyperledger/fabric/core/crypto"
3534
"github.com/hyperledger/fabric/core/ledger"
35+
"github.com/hyperledger/fabric/core/util"
3636
"github.com/hyperledger/fabric/membersrvc/ca"
3737
pb "github.com/hyperledger/fabric/protos"
3838
"github.com/op/go-logging"
@@ -180,7 +180,7 @@ func deploy(admCert crypto.CertificateHandler) error {
180180
spec := &pb.ChaincodeSpec{
181181
Type: 1,
182182
ChaincodeID: &pb.ChaincodeID{Name: "mycc"},
183-
CtorMsg: &pb.ChaincodeInput{Function: "init", Args: []string{}},
183+
CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("init")},
184184
Metadata: []byte("assigner"),
185185
ConfidentialityLevel: pb.ConfidentialityLevel_PUBLIC,
186186
}
@@ -224,7 +224,7 @@ func assignOwnership(assigner crypto.Client, asset string, newOwnerCert crypto.C
224224
}
225225

226226
newOwner := base64.StdEncoding.EncodeToString(newOwnerCert.GetCertificate())
227-
chaincodeInput := &pb.ChaincodeInput{Function: "assign", Args: []string{asset, newOwner}}
227+
chaincodeInput := &pb.ChaincodeInput{Args: util.ToChaincodeArgs("assign", asset, newOwner)}
228228

229229
// Prepare spec and submit
230230
spec := &pb.ChaincodeSpec{
@@ -270,7 +270,7 @@ func transferOwnership(owner crypto.Client, ownerCert crypto.CertificateHandler,
270270
}
271271

272272
newOwner := base64.StdEncoding.EncodeToString(newOwnerCert.GetCertificate())
273-
chaincodeInput := &pb.ChaincodeInput{Function: "transfer", Args: []string{asset, newOwner}}
273+
chaincodeInput := &pb.ChaincodeInput{Args: util.ToChaincodeArgs("transfer", asset, newOwner)}
274274

275275
// Prepare spec and submit
276276
spec := &pb.ChaincodeSpec{
@@ -304,7 +304,7 @@ func transferOwnership(owner crypto.Client, ownerCert crypto.CertificateHandler,
304304
}
305305

306306
func whoIsTheOwner(asset string) ([]byte, error) {
307-
chaincodeInput := &pb.ChaincodeInput{Function: "query", Args: []string{asset}}
307+
chaincodeInput := &pb.ChaincodeInput{Args: util.ToChaincodeArgs("query", asset)}
308308

309309
// Prepare spec and submit
310310
spec := &pb.ChaincodeSpec{
@@ -364,7 +364,6 @@ func setup() {
364364
}
365365

366366
func initMembershipSrvc() {
367-
ca.LogInit(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr, os.Stdout)
368367
ca.CacheConfiguration() // Cache configuration
369368
aca = ca.NewACA()
370369
eca = ca.NewECA()

0 commit comments

Comments
 (0)