Skip to content

Commit 673ca7b

Browse files
committed
Merge remote-tracking branch 'benma/golangci'
2 parents bfbda63 + 099121b commit 673ca7b

File tree

11 files changed

+38
-30
lines changed

11 files changed

+38
-30
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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# options for analysis running
55
run:
6-
go: 1.20
6+
go: 1.21
77

88
# default concurrency is a available CPU number
99
concurrency: 4
@@ -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: 2 additions & 2 deletions
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
@@ -33,7 +33,7 @@ envinit:
3333
# Initializiation on MacOS
3434
# - run make from $GOPATH/src/github.com/digitalbitbox/bitbox-wallet-app
3535
# - additional dependencies: Qt 5.15 & Xcode command line tools
36-
# - add to $PATH: /usr/local/opt/go@1.20/bin
36+
# - add to $PATH: /usr/local/opt/go@1.21/bin
3737
osx-init:
3838
./scripts/osx-brew.sh
3939
$(MAKE) envinit

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The below instructions assume a unix environment.
4747

4848
To build the app or run the development workflow, the following dependencies need to be installed:
4949

50-
- [Go](https://golang.org/doc/install) version 1.20
50+
- [Go](https://golang.org/doc/install) version 1.21
5151
- [Node.js](https://nodejs.org/) version 18.x
5252
- [NPM](https://docs.npmjs.com/about-npm-versions) version 9.x or newer
5353
- [Qt5](https://www.qt.io) version 5.15.2
@@ -193,4 +193,4 @@ Get Ethereum Goerli coins here: https://goerlifaucet.com/
193193

194194
Get Ethereum Sepolia coins here: https://faucet.sepolia.dev/
195195

196-
In case any of the Ethereum faucets are not working, you can try others from here: https://faucetlink.to (some require account creation)
196+
In case any of the Ethereum faucets are not working, you can try others from here: https://faucetlink.to (some require account creation)

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ environment:
1111

1212
# https://www.appveyor.com/docs/windows-images-software/#golang
1313
# If you change this, also change the GOROOT variable above to point to the right installation folder.
14-
stack: go 1.20
14+
stack: go 1.21
1515

1616
install:
1717
- ps: Install-Product node $env:nodejs_version

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
var rootFingerprint2 = []byte{0x66, 0x066, 0x66, 0x66}
4143

@@ -195,7 +197,7 @@ func TestAOPPSuccess(t *testing.T) {
195197
params.Set("callback", callback)
196198

197199
require.Equal(t, AOPP{State: aoppStateInactive}, b.AOPP())
198-
b.HandleURI("aopp:?" + params.Encode())
200+
b.HandleURI(uriPrefix + params.Encode())
199201
require.Equal(t,
200202
AOPP{
201203
State: aoppStateUserApproval,
@@ -268,7 +270,7 @@ func TestAOPPSuccess(t *testing.T) {
268270
defer b.Close()
269271
params := defaultParams()
270272
params.Set("callback", server.URL)
271-
b.HandleURI("aopp:?" + params.Encode())
273+
b.HandleURI(uriPrefix + params.Encode())
272274
require.Equal(t, aoppStateUserApproval, b.AOPP().State)
273275
b.AOPPApprove()
274276
require.Equal(t, aoppStateAwaitingKeystore, b.AOPP().State)
@@ -288,7 +290,7 @@ func TestAOPPSuccess(t *testing.T) {
288290
params := defaultParams()
289291
params.Set("callback", server.URL)
290292
b.registerKeystore(makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey))
291-
b.HandleURI("aopp:?" + params.Encode())
293+
b.HandleURI(uriPrefix + params.Encode())
292294
require.Equal(t, aoppStateUserApproval, b.AOPP().State)
293295
b.AOPPApprove()
294296
require.Equal(t, aoppStateSuccess, b.AOPP().State)
@@ -300,7 +302,7 @@ func TestAOPPSuccess(t *testing.T) {
300302
defer b.Close()
301303
params := defaultParams()
302304
b.registerKeystore(makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey))
303-
b.HandleURI("aopp:?" + params.Encode())
305+
b.HandleURI(uriPrefix + params.Encode())
304306
require.Equal(t, aoppStateUserApproval, b.AOPP().State)
305307
b.DeregisterKeystore()
306308
b.AOPPApprove()
@@ -349,7 +351,7 @@ func TestAOPPFailures(t *testing.T) {
349351
defer b.Close()
350352
params := defaultParams()
351353
params.Set("v", "1")
352-
b.HandleURI("aopp:?" + params.Encode())
354+
b.HandleURI(uriPrefix + params.Encode())
353355
require.Equal(t, aoppStateError, b.AOPP().State)
354356
require.Equal(t, errAOPPVersion, b.AOPP().ErrorCode)
355357

@@ -359,7 +361,7 @@ func TestAOPPFailures(t *testing.T) {
359361
defer b.Close()
360362
params := defaultParams()
361363
params.Del("callback")
362-
b.HandleURI("aopp:?" + params.Encode())
364+
b.HandleURI(uriPrefix + params.Encode())
363365
require.Equal(t, aoppStateError, b.AOPP().State)
364366
require.Equal(t, errAOPPInvalidRequest, b.AOPP().ErrorCode)
365367
})
@@ -368,7 +370,7 @@ func TestAOPPFailures(t *testing.T) {
368370
defer b.Close()
369371
params := defaultParams()
370372
params.Set("callback", ":not a valid url")
371-
b.HandleURI("aopp:?" + params.Encode())
373+
b.HandleURI(uriPrefix + params.Encode())
372374
require.Equal(t, aoppStateError, b.AOPP().State)
373375
require.Equal(t, errAOPPInvalidRequest, b.AOPP().ErrorCode)
374376
})
@@ -377,7 +379,7 @@ func TestAOPPFailures(t *testing.T) {
377379
defer b.Close()
378380
params := defaultParams()
379381
params.Del("msg")
380-
b.HandleURI("aopp:?" + params.Encode())
382+
b.HandleURI(uriPrefix + params.Encode())
381383
require.Equal(t, aoppStateError, b.AOPP().State)
382384
require.Equal(t, errAOPPInvalidRequest, b.AOPP().ErrorCode)
383385
})
@@ -386,15 +388,15 @@ func TestAOPPFailures(t *testing.T) {
386388
defer b.Close()
387389
params := defaultParams()
388390
params.Set("asset", "<invalid>")
389-
b.HandleURI("aopp:?" + params.Encode())
391+
b.HandleURI(uriPrefix + params.Encode())
390392
require.Equal(t, aoppStateError, b.AOPP().State)
391393
require.Equal(t, errAOPPUnsupportedAsset, b.AOPP().ErrorCode)
392394
})
393395
t.Run("cant_sign", func(t *testing.T) {
394396
b := newBackend(t, testnetDisabled, regtestDisabled)
395397
defer b.Close()
396398
params := defaultParams()
397-
b.HandleURI("aopp:?" + params.Encode())
399+
b.HandleURI(uriPrefix + params.Encode())
398400
b.AOPPApprove()
399401
ks2 := makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey)
400402
ks2.CanSignMessageFunc = func(coinpkg.Code) bool {
@@ -410,7 +412,7 @@ func TestAOPPFailures(t *testing.T) {
410412
params := defaultParams()
411413
b.registerKeystore(ks)
412414
require.NoError(t, b.SetAccountActive("v0-55555555-btc-0", false))
413-
b.HandleURI("aopp:?" + params.Encode())
415+
b.HandleURI(uriPrefix + params.Encode())
414416
b.AOPPApprove()
415417
require.Equal(t, aoppStateError, b.AOPP().State)
416418
require.Equal(t, errAOPPNoAccounts, b.AOPP().ErrorCode)
@@ -420,7 +422,7 @@ func TestAOPPFailures(t *testing.T) {
420422
defer b.Close()
421423
params := defaultParams()
422424
params.Set("format", "p2pkh")
423-
b.HandleURI("aopp:?" + params.Encode())
425+
b.HandleURI(uriPrefix + params.Encode())
424426
b.AOPPApprove()
425427
b.registerKeystore(ks)
426428
require.Equal(t, aoppStateError, b.AOPP().State)
@@ -430,7 +432,7 @@ func TestAOPPFailures(t *testing.T) {
430432
b := newBackend(t, testnetDisabled, regtestDisabled)
431433
defer b.Close()
432434
params := defaultParams()
433-
b.HandleURI("aopp:?" + params.Encode())
435+
b.HandleURI(uriPrefix + params.Encode())
434436
b.AOPPApprove()
435437
ks2 := makeKeystore(t, scriptTypeRef(signing.ScriptTypeP2WPKH), keystoreHelper.ExtendedPublicKey)
436438
ks2.SignBTCMessageFunc = func([]byte, signing.AbsoluteKeypath, signing.ScriptType) ([]byte, error) {
@@ -452,7 +454,7 @@ func TestAOPPFailures(t *testing.T) {
452454

453455
params := defaultParams()
454456
params.Set("callback", server.URL)
455-
b.HandleURI("aopp:?" + params.Encode())
457+
b.HandleURI(uriPrefix + params.Encode())
456458
b.AOPPApprove()
457459
b.registerKeystore(ks)
458460
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))

docs/BUILD.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Build artifacts:
3030

3131
## MacOS
3232

33-
Make sure you have `qt@5/bin`, `go@1.20/bin` and `go/bin` in your PATH, i.e. add to your `.zshrc`
33+
Make sure you have `qt@5/bin`, `go@1.21/bin` and `go/bin` in your PATH, i.e. add to your `.zshrc`
3434

3535
```bash
3636
export PATH="$PATH:/usr/local/opt/qt@5/bin"
37-
export PATH="$PATH:/usr/local/opt/go@1.20/bin"
37+
export PATH="$PATH:/usr/local/opt/go@1.21/bin"
3838
export PATH="$PATH:$HOME/go/bin"
3939
```
4040

@@ -67,7 +67,7 @@ $ xcrun altool --notarization-info NOTARIZATION_ID --username "APPLE_ID" --pass
6767
The build requires `Microsoft Visual Studio 2019 Community Edition`, with the `MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)`
6868
individual component.
6969

70-
It also requires `mingw-w64`, `bash` (e.g. `git-bash`), `make`,`go 1.20`, `node@18`, `QT 5.15.2` with `qtwebengine`, `nsis`
70+
It also requires `mingw-w64`, `bash` (e.g. `git-bash`), `make`,`go 1.21`, `node@18`, `QT 5.15.2` with `qtwebengine`, `nsis`
7171
and possibly other tools.
7272

7373
Some of the tools are easy to install with `choco`:

scripts/docker_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ npm install -g npm@9.6.5
4646
npm install -g locize-cli
4747

4848
mkdir -p /opt/go_dist
49-
curl https://dl.google.com/go/go1.20.1.linux-amd64.tar.gz | tar -xz -C /opt/go_dist
49+
curl https://dl.google.com/go/go1.21.6.linux-amd64.tar.gz | tar -xz -C /opt/go_dist
5050

5151
# Needed for qt5. fuse is needed to run the linuxdeployqt appimage.
5252
apt-get install -y --no-install-recommends fuse

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)