Skip to content

Commit a6b112a

Browse files
Update staticcheck version (#5071)
Signed-off-by: Mark S. Lewis <[email protected]>
1 parent b8746e1 commit a6b112a

File tree

8 files changed

+16
-20
lines changed

8 files changed

+16
-20
lines changed

cmd/configtxlator/main.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,6 @@ func computeUpdt(original, updated, output *os.File, channelID string) error {
220220

221221
cu.ChannelId = channelID
222222

223-
if cu == nil {
224-
return errors.New("error marshaling computed config update: proto: Marshal called with nil")
225-
}
226223
outBytes, err := proto.Marshal(cu)
227224
if err != nil {
228225
return errors.Wrapf(err, "error marshaling computed config update")

core/chaincode/accesscontrol/access.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func (ac *Authenticator) authenticate(msg *pb.ChaincodeMessage, stream grpc.Serv
8787
if registeredName != ccName {
8888
errMsg := fmt.Sprintf("Chaincode %s with given certificate hash %v belongs to a different chaincode", ccName, hash)
8989
logger.Warning(errMsg)
90-
return fmt.Errorf(errMsg)
90+
return errors.New(errMsg)
9191
}
9292

9393
logger.Debug("Chaincode", ccName, "'s authentication is authorized")

core/common/validation/msgvalidation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ func validateSignatureHeader(sHdr *common.SignatureHeader) error {
7171
}
7272

7373
// ensure that there is a nonce
74-
if sHdr.Nonce == nil || len(sHdr.Nonce) == 0 {
74+
if len(sHdr.Nonce) == 0 {
7575
return errors.New("invalid nonce specified in the header")
7676
}
7777

7878
// ensure that there is a creator
79-
if sHdr.Creator == nil || len(sHdr.Creator) == 0 {
79+
if len(sHdr.Creator) == 0 {
8080
return errors.New("invalid creator specified in the header")
8181
}
8282

core/ledger/kvledger/txmgmt/privacyenabledstate/snapshot_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/stretchr/testify/require"
2424
"google.golang.org/protobuf/encoding/protowire"
2525
"google.golang.org/protobuf/proto"
26-
protoV2 "google.golang.org/protobuf/proto"
2726
"google.golang.org/protobuf/protoadapt"
2827
)
2928

@@ -567,7 +566,7 @@ func TestSnapshotImportErrorPropagation(t *testing.T) {
567566
srTmp := protoadapt.MessageV2Of(sr)
568567
var buf []byte
569568
buf = protowire.AppendVarint(buf, uint64(proto.Size(sr)))
570-
nbuf, err := protoV2.MarshalOptions{
569+
nbuf, err := proto.MarshalOptions{
571570
Deterministic: false,
572571
AllowPartial: true,
573572
}.MarshalAppend(buf, srTmp)

core/scc/qscc/query_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestQueryGetChainInfo(t *testing.T) {
9696

9797
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
9898
if err != nil {
99-
t.Fatalf(err.Error())
99+
t.Fatal(err.Error())
100100
}
101101
defer cleanup()
102102

@@ -128,7 +128,7 @@ func TestQueryGetTransactionByID(t *testing.T) {
128128

129129
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
130130
if err != nil {
131-
t.Fatalf(err.Error())
131+
t.Fatal(err.Error())
132132
}
133133
defer cleanup()
134134

@@ -164,7 +164,7 @@ func TestQueryGetBlockByNumber(t *testing.T) {
164164

165165
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
166166
if err != nil {
167-
t.Fatalf(err.Error())
167+
t.Fatal(err.Error())
168168
}
169169
defer cleanup()
170170

@@ -201,7 +201,7 @@ func TestQueryGetBlockByHash(t *testing.T) {
201201

202202
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
203203
if err != nil {
204-
t.Fatalf(err.Error())
204+
t.Fatal(err.Error())
205205
}
206206
defer cleanup()
207207

@@ -228,7 +228,7 @@ func TestQueryGetBlockByTxID(t *testing.T) {
228228

229229
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
230230
if err != nil {
231-
t.Fatalf(err.Error())
231+
t.Fatal(err.Error())
232232
}
233233
defer cleanup()
234234

@@ -290,7 +290,7 @@ func TestFailingAccessControl(t *testing.T) {
290290

291291
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
292292
if err != nil {
293-
t.Fatalf(err.Error())
293+
t.Fatal(err.Error())
294294
}
295295
defer cleanup()
296296

@@ -415,7 +415,7 @@ func TestQueryNonexistentFunction(t *testing.T) {
415415

416416
mockStub, lq, _, cleanup, err := setupTestLedger(t, chainid, path)
417417
if err != nil {
418-
t.Fatalf(err.Error())
418+
t.Fatal(err.Error())
419419
}
420420
defer cleanup()
421421

@@ -436,7 +436,7 @@ func TestQueryGeneratedBlock(t *testing.T) {
436436

437437
mockStub, lq, p, cleanup, err := setupTestLedger(t, chainid, path)
438438
if err != nil {
439-
t.Fatalf(err.Error())
439+
t.Fatal(err.Error())
440440
}
441441
defer cleanup()
442442

@@ -471,7 +471,7 @@ func TestQueryGeneratedBlock(t *testing.T) {
471471
}
472472
chdr, err := protoutil.UnmarshalChannelHeader(payload.Header.ChannelHeader)
473473
if err != nil {
474-
t.Fatalf(err.Error())
474+
t.Fatal(err.Error())
475475
}
476476
if common.HeaderType(chdr.Type) == common.HeaderType_ENDORSER_TRANSACTION {
477477
args = [][]byte{[]byte(GetBlockByTxID), []byte(chainid), []byte(chdr.TxId)}

gotools.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ go.fqp.misspell := github.com/client9/misspell/cmd/misspell
2121
go.fqp.mockery := github.com/vektra/mockery/cmd/mockery
2222
go.fqp.protoc-gen-go := google.golang.org/protobuf/cmd/protoc-gen-go
2323
go.fqp.protoc-gen-go-grpc := google.golang.org/grpc/cmd/protoc-gen-go-grpc
24-
go.fqp.staticcheck := honnef.co/go/tools/cmd/staticcheck@2023.1.7
24+
go.fqp.staticcheck := honnef.co/go/tools/cmd/staticcheck@2024.1.1
2525
go.fqp.swagger := github.com/go-swagger/go-swagger/cmd/swagger
2626

2727
.PHONY: gotools-install

internal/peer/chaincode/invoke_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func getMockDeliverClientRespondAfterDelay(delayChan chan struct{}, txStatus pb.
391391
func getMockDeliverClientWithErr(errMsg string) *mock.PeerDeliverClient {
392392
mockDC := &mock.PeerDeliverClient{}
393393
mockDC.DeliverFilteredStub = func(ctx context.Context, opts ...grpc.CallOption) (pb.Deliver_DeliverFilteredClient, error) {
394-
return nil, fmt.Errorf(errMsg)
394+
return nil, errors.New(errMsg)
395395
}
396396
return mockDC
397397
}

orderer/consensus/smartbft/configverifier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (cbv *ConfigBlockValidator) checkConsentersMatchPolicy(conf *cb.Config) err
152152
Value: protoutil.MarshalOrPanic(sp),
153153
}
154154

155-
if conf.ChannelGroup.Groups["Orderer"].Policies == nil || len(conf.ChannelGroup.Groups["Orderer"].Policies) == 0 {
155+
if len(conf.ChannelGroup.Groups["Orderer"].Policies) == 0 {
156156
return fmt.Errorf("empty policies in 'Orderer' group")
157157
}
158158

0 commit comments

Comments
 (0)