Skip to content

Commit 099121b

Browse files
committed
ci: update golangci to 1.55.2
Disable some useless/annoying linters. The docker image change also includes the update to Go 1.21.
1 parent 50c164c commit 099121b

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
# https://docs.github.com/en/packages/guides/pushing-and-pulling-docker-images
2222
#
2323
# Keep this in sync with default in scripts/github-ci.sh.
24-
CI_IMAGE: ghcr.io/digitalbitbox/bitbox-wallet-app-ci:19
24+
CI_IMAGE: ghcr.io/digitalbitbox/bitbox-wallet-app-ci:20
2525
GITHUB_BUILD_DIR: ${{github.workspace}}
2626

2727
jobs:

.golangci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ linters:
141141
- structcheck
142142
- deadcode
143143
- varcheck
144+
- depguard
145+
- inamedparam
146+
- protogetter
147+
- gosmopolitan
148+
# todo: enable this, but there are a lot of hits
149+
- testifylint
144150
disable-all: false
145151

146152
issues:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ catch:
2121
@echo "Choose a make target."
2222
envinit:
2323
# Keep golangci-lint version in sync with what's in .github/workflows/ci.yml.
24-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin v1.51.1
24+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin v1.55.2
2525
go install github.com/vektra/mockery/v2@latest
2626
go install github.com/matryer/moq@latest
2727
go install golang.org/x/tools/cmd/goimports@latest

backend/aopp_test.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import (
3636
const dummyMsg = "message to be signed"
3737
const dummySignature = "signature"
3838

39+
const uriPrefix = "aopp:?"
40+
3941
var rootFingerprint = []byte{0x55, 0x055, 0x55, 0x55}
4042

4143
func defaultParams() url.Values {
@@ -194,7 +196,7 @@ func TestAOPPSuccess(t *testing.T) {
194196
params.Set("callback", callback)
195197

196198
require.Equal(t, AOPP{State: aoppStateInactive}, b.AOPP())
197-
b.HandleURI("aopp:?" + params.Encode())
199+
b.HandleURI(uriPrefix + params.Encode())
198200
require.Equal(t,
199201
AOPP{
200202
State: aoppStateUserApproval,
@@ -267,7 +269,7 @@ func TestAOPPSuccess(t *testing.T) {
267269
defer b.Close()
268270
params := defaultParams()
269271
params.Set("callback", server.URL)
270-
b.HandleURI("aopp:?" + params.Encode())
272+
b.HandleURI(uriPrefix + params.Encode())
271273
require.Equal(t, aoppStateUserApproval, b.AOPP().State)
272274
b.AOPPApprove()
273275
require.Equal(t, aoppStateAwaitingKeystore, b.AOPP().State)
@@ -287,7 +289,7 @@ func TestAOPPSuccess(t *testing.T) {
287289
params := defaultParams()
288290
params.Set("callback", server.URL)
289291
b.registerKeystore(makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey))
290-
b.HandleURI("aopp:?" + params.Encode())
292+
b.HandleURI(uriPrefix + params.Encode())
291293
require.Equal(t, aoppStateUserApproval, b.AOPP().State)
292294
b.AOPPApprove()
293295
require.Equal(t, aoppStateSuccess, b.AOPP().State)
@@ -299,7 +301,7 @@ func TestAOPPSuccess(t *testing.T) {
299301
defer b.Close()
300302
params := defaultParams()
301303
b.registerKeystore(makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey))
302-
b.HandleURI("aopp:?" + params.Encode())
304+
b.HandleURI(uriPrefix + params.Encode())
303305
require.Equal(t, aoppStateUserApproval, b.AOPP().State)
304306
b.DeregisterKeystore()
305307
b.AOPPApprove()
@@ -318,7 +320,7 @@ func TestAOPPFailures(t *testing.T) {
318320
defer b.Close()
319321
params := defaultParams()
320322
params.Set("v", "1")
321-
b.HandleURI("aopp:?" + params.Encode())
323+
b.HandleURI(uriPrefix + params.Encode())
322324
require.Equal(t, aoppStateError, b.AOPP().State)
323325
require.Equal(t, errAOPPVersion, b.AOPP().ErrorCode)
324326

@@ -328,7 +330,7 @@ func TestAOPPFailures(t *testing.T) {
328330
defer b.Close()
329331
params := defaultParams()
330332
params.Del("callback")
331-
b.HandleURI("aopp:?" + params.Encode())
333+
b.HandleURI(uriPrefix + params.Encode())
332334
require.Equal(t, aoppStateError, b.AOPP().State)
333335
require.Equal(t, errAOPPInvalidRequest, b.AOPP().ErrorCode)
334336
})
@@ -337,7 +339,7 @@ func TestAOPPFailures(t *testing.T) {
337339
defer b.Close()
338340
params := defaultParams()
339341
params.Set("callback", ":not a valid url")
340-
b.HandleURI("aopp:?" + params.Encode())
342+
b.HandleURI(uriPrefix + params.Encode())
341343
require.Equal(t, aoppStateError, b.AOPP().State)
342344
require.Equal(t, errAOPPInvalidRequest, b.AOPP().ErrorCode)
343345
})
@@ -346,7 +348,7 @@ func TestAOPPFailures(t *testing.T) {
346348
defer b.Close()
347349
params := defaultParams()
348350
params.Del("msg")
349-
b.HandleURI("aopp:?" + params.Encode())
351+
b.HandleURI(uriPrefix + params.Encode())
350352
require.Equal(t, aoppStateError, b.AOPP().State)
351353
require.Equal(t, errAOPPInvalidRequest, b.AOPP().ErrorCode)
352354
})
@@ -355,15 +357,15 @@ func TestAOPPFailures(t *testing.T) {
355357
defer b.Close()
356358
params := defaultParams()
357359
params.Set("asset", "<invalid>")
358-
b.HandleURI("aopp:?" + params.Encode())
360+
b.HandleURI(uriPrefix + params.Encode())
359361
require.Equal(t, aoppStateError, b.AOPP().State)
360362
require.Equal(t, errAOPPUnsupportedAsset, b.AOPP().ErrorCode)
361363
})
362364
t.Run("cant_sign", func(t *testing.T) {
363365
b := newBackend(t, testnetDisabled, regtestDisabled)
364366
defer b.Close()
365367
params := defaultParams()
366-
b.HandleURI("aopp:?" + params.Encode())
368+
b.HandleURI(uriPrefix + params.Encode())
367369
b.AOPPApprove()
368370
ks2 := makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey)
369371
ks2.CanSignMessageFunc = func(coinpkg.Code) bool {
@@ -379,7 +381,7 @@ func TestAOPPFailures(t *testing.T) {
379381
params := defaultParams()
380382
b.registerKeystore(ks)
381383
require.NoError(t, b.SetAccountActive("v0-55555555-btc-0", false))
382-
b.HandleURI("aopp:?" + params.Encode())
384+
b.HandleURI(uriPrefix + params.Encode())
383385
b.AOPPApprove()
384386
require.Equal(t, aoppStateError, b.AOPP().State)
385387
require.Equal(t, errAOPPNoAccounts, b.AOPP().ErrorCode)
@@ -389,7 +391,7 @@ func TestAOPPFailures(t *testing.T) {
389391
defer b.Close()
390392
params := defaultParams()
391393
params.Set("format", "p2pkh")
392-
b.HandleURI("aopp:?" + params.Encode())
394+
b.HandleURI(uriPrefix + params.Encode())
393395
b.AOPPApprove()
394396
b.registerKeystore(ks)
395397
require.Equal(t, aoppStateError, b.AOPP().State)
@@ -399,7 +401,7 @@ func TestAOPPFailures(t *testing.T) {
399401
b := newBackend(t, testnetDisabled, regtestDisabled)
400402
defer b.Close()
401403
params := defaultParams()
402-
b.HandleURI("aopp:?" + params.Encode())
404+
b.HandleURI(uriPrefix + params.Encode())
403405
b.AOPPApprove()
404406
ks2 := makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey)
405407
ks2.SignBTCMessageFunc = func([]byte, signing.AbsoluteKeypath, signing.ScriptType) ([]byte, error) {
@@ -421,7 +423,7 @@ func TestAOPPFailures(t *testing.T) {
421423

422424
params := defaultParams()
423425
params.Set("callback", server.URL)
424-
b.HandleURI("aopp:?" + params.Encode())
426+
b.HandleURI(uriPrefix + params.Encode())
425427
b.AOPPApprove()
426428
b.registerKeystore(ks)
427429
b.AOPPChooseAccount("v0-55555555-btc-0")

backend/coins/btc/db/headersdb/headersdb_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ func TestFixTrailingZeroes(t *testing.T) {
5959
require.NoError(t, err)
6060
filename := f.Name()
6161

62-
_, err = f.Write([]byte(
62+
_, err = f.WriteString(
6363
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
6464
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
65-
))
65+
)
6666
require.NoError(t, err)
6767
// Add 10 zero-byte headers that will be stripped off.
6868
_, err = f.Write(make([]byte, 80*10))

scripts/github-ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if [ "$OS_NAME" == "linux" ]; then
1212
# Which docker image to use to run the CI. Defaults to Docker Hub.
1313
# Overwrite with CI_IMAGE=docker/image/path environment variable.
1414
# Keep this in sync with .github/workflows/ci.yml.
15-
: "${CI_IMAGE:=shiftcrypto/bitbox-wallet-app:19}"
15+
: "${CI_IMAGE:=shiftcrypto/bitbox-wallet-app:20}"
1616
# Time image pull to compare in the future.
1717
time docker pull "$CI_IMAGE"
1818

0 commit comments

Comments
 (0)