Skip to content

Commit 01e9800

Browse files
committed
fix: fix goling lint
1 parent 9c9ae93 commit 01e9800

5 files changed

Lines changed: 36 additions & 33 deletions

File tree

client.go

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
//nolint:dupl,unparam
12
package main
23

34
import (
45
"encoding/binary"
56
"encoding/json"
67
"fmt"
7-
"github.com/meshplus/bitxhub-core/agency"
88
"os"
99
"strconv"
1010
"strings"
1111
"time"
1212

13+
"github.com/meshplus/bitxhub-core/agency"
14+
1315
"github.com/Rican7/retry"
1416
"github.com/Rican7/retry/strategy"
1517
"github.com/golang/protobuf/proto"
@@ -129,10 +131,7 @@ func (c *Client) Initialize(configPath string, extra []byte, mode string) error
129131
// m = make(map[string]*pb.Interchain)
130132
// }
131133

132-
mgh, err := newFabricHandler(contractmeta.EventFilter, eventC)
133-
if err != nil {
134-
return err
135-
}
134+
mgh := newFabricHandler(contractmeta.EventFilter, eventC)
136135

137136
done := make(chan bool)
138137
csm, err := NewConsumer(configPath, contractmeta, mgh, done)
@@ -316,6 +315,7 @@ func (c *Client) getProof(response channel.Response) ([]byte, error) {
316315
return nil
317316
}, strategy.Wait(2*time.Second)); err != nil {
318317
logger.Error("Can't get proof", "error", err.Error())
318+
return nil, err
319319
}
320320

321321
return proof, nil
@@ -400,6 +400,9 @@ func (c *Client) SubmitIBTP(from string, index uint64, serviceID string, ibtpTyp
400400
destFullID := c.bitxhubID + ":" + c.appchainID + ":" + serviceID
401401
servicePair := from + "-" + destFullID
402402
ibtp, err := c.GetReceiptMessage(servicePair, index)
403+
if err != nil {
404+
return nil, err
405+
}
403406
ret.Result = ibtp
404407

405408
return ret, nil
@@ -891,11 +894,11 @@ type handler struct {
891894
ID string
892895
}
893896

894-
func newFabricHandler(eventFilter string, eventC chan *pb.IBTP) (*handler, error) {
897+
func newFabricHandler(eventFilter string, eventC chan *pb.IBTP) *handler {
895898
return &handler{
896899
eventC: eventC,
897900
eventFilter: eventFilter,
898-
}, nil
901+
}
899902
}
900903

901904
func (h *handler) HandleMessage(deliveries *fab.CCEvent, payload []byte) {
@@ -910,14 +913,14 @@ func (h *handler) HandleMessage(deliveries *fab.CCEvent, payload []byte) {
910913
}
911914
}
912915

913-
func parseChainServiceID(id string) (string, string, string, error) {
914-
splits := strings.Split(id, ":")
915-
if len(splits) != 3 {
916-
return "", "", "", fmt.Errorf("invalid chain service ID: %s", id)
917-
}
916+
// func parseChainServiceID(id string) (string, string, string, error) {
917+
// splits := strings.Split(id, ":")
918+
// if len(splits) != 3 {
919+
// return "", "", "", fmt.Errorf("invalid chain service ID: %s", id)
920+
// }
918921

919-
return splits[0], splits[1], splits[2], nil
920-
}
922+
// return splits[0], splits[1], splits[2], nil
923+
// }
921924

922925
func parseServicePair(servicePair string) (string, string, error) {
923926
splits := strings.Split(servicePair, "-")
@@ -928,9 +931,9 @@ func parseServicePair(servicePair string) (string, string, error) {
928931
return splits[0], splits[1], nil
929932
}
930933

931-
func genServicePair(from, to string) string {
932-
return fmt.Sprintf("%s-%s", from, to)
933-
}
934+
// func genServicePair(from, to string) string {
935+
// return fmt.Sprintf("%s-%s", from, to)
936+
// }
934937

935938
func (c *Client) GetOffChainData(request *pb.GetDataRequest) (*pb.OffChainDataInfo, error) {
936939
//TODO implement me

consumer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:unparam
12
package main
23

34
import (

event.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package main
22

33
import (
4-
"strings"
5-
64
"github.com/cloudflare/cfssl/log"
75
"github.com/ethereum/go-ethereum/crypto"
86
"github.com/meshplus/bitxhub-model/pb"
@@ -34,14 +32,14 @@ func (ev *Event) Convert2IBTP(timeoutHeight int64, ibtpType pb.IBTP_Type) *pb.IB
3432
}
3533
}
3634

37-
func handleArgs(args string) [][]byte {
38-
argsBytes := make([][]byte, 0)
39-
as := strings.Split(args, ",")
40-
for _, a := range as {
41-
argsBytes = append(argsBytes, []byte(a))
42-
}
43-
return argsBytes
44-
}
35+
// func handleArgs(args string) [][]byte {
36+
// argsBytes := make([][]byte, 0)
37+
// as := strings.Split(args, ",")
38+
// for _, a := range as {
39+
// argsBytes = append(argsBytes, []byte(a))
40+
// }
41+
// return argsBytes
42+
// }
4543

4644
func (ev *Event) encryptPayload() ([]byte, error) {
4745
content := &pb.Content{

receipt.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//nolint:unparam
12
package main
23

34
import (

verify.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
//nolint:unparam
12
package main
23

34
import (
45
"context"
5-
"encoding/binary"
66
"encoding/json"
77
"fmt"
88
"math/big"
@@ -145,10 +145,10 @@ func addressArrayContains(addrs []string, address []byte) bool {
145145
return false
146146
}
147147

148-
func uint64ToBytesInBigEndian(i uint64) []byte {
149-
bytes := make([]byte, 8)
148+
// func uint64ToBytesInBigEndian(i uint64) []byte {
149+
// bytes := make([]byte, 8)
150150

151-
binary.BigEndian.PutUint64(bytes, i)
151+
// binary.BigEndian.PutUint64(bytes, i)
152152

153-
return bytes
154-
}
153+
// return bytes
154+
// }

0 commit comments

Comments
 (0)