Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
name: ci
on: [push, pull_request]
env:
GO_VERSION: "^1.22"
GOLANGCI_LINT_VERSION: "v1.62.0"
GO_VERSION: "^1.24"
GOLANGCI_LINT_VERSION: "v2.8.0"

jobs:
lint:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
sh -s -- -b $HOME $GOLANGCI_LINT_VERSION
- name: Lint
run: ~/golangci-lint run --skip-dirs=cmd/playground,cmd/miniscript
run: ~/golangci-lint run
test:
runs-on: ubuntu-22.04
steps:
Expand Down
197 changes: 83 additions & 114 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,134 +1,103 @@
# See reference docs for details:
# https://golangci-lint.run/usage/configuration/

# options for analysis running
version: "2"
run:
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 10m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# output configuration options
output:
# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true


# all available settings of specific linters
linters-settings:
gocritic:
enabled-checks:
- builtinShadow
- nilValReturn
- rangeExprCopy
- rangeValCopy
- typeUnparen
gocyclo:
min-complexity: 29
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
dupl:
# tokens count to trigger issue, 150 by default
threshold: 150
goconst:
# minimal length of string constant, 3 by default
min-len: 3
# minimal occurrences count to trigger, 3 by default
min-occurrences: 3
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
# allow long comments.
exclude: '//'

linters:
enable-all: true
default: all
disable:
- gosec
- bodyclose
- cyclop
- depguard
- dogsled
- dupl
- err113
- errname
- errorlint
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert
- funcorder
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- gocyclo
- godox
- lll
- nestif
- prealloc
- stylecheck
- whitespace
- wsl
- gosec
- gosmopolitan
- inamedparam
- interfacebloat
- ireturn
- err113
- wrapcheck
- varnamelen
- tagliatelle
- paralleltest
- nonamedreturns
- noctx
- nlreturn
- cyclop
- exhaustive
- nilnil
- nilerr
- forcetypeassert
- exhaustruct
- lll
- maintidx
- errorlint
- gofumpt
- gci
- errname
- forbidigo
- makezero
- nolintlint
- gocyclo
- interfacebloat
- revive
- mnd
- modernize
- musttag
- depguard
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- noinlineerr
- nolintlint
- nonamedreturns
- paralleltest
- perfsprint
- prealloc
- protogetter
- gosmopolitan
- inamedparam
# could not find a way to disable float-compare: https://github.com/golangci/golangci-lint/issues/4187
- revive
- tagliatelle
- testifylint
- mnd
disable-all: false

issues:
# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
# Use linters in their original configuration. golangci-linter changes the default config, for
# example skipping the docstring comment checks of golint.
exclude-use-default: false

# Excluding configuration per-path, per-linter, per-text and per-source.
exclude-rules:
# In addition to always disalbed linters above, exclude some more in tests.
- path: _test\.go
linters:
- errcheck
- gocyclo
- godot
- gosec
- testpackage
- varnamelen
- whitespace
- wrapcheck
- wsl
- wsl_v5
settings:
dupl:
threshold: 150
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-checks:
- builtinShadow
- nilValReturn
- rangeExprCopy
- rangeValCopy
- typeUnparen
gocyclo:
min-complexity: 29
lll:
line-length: 120
misspell:
locale: US
exclusions:
generated: lax
rules:
- linters:
- errcheck
- gocyclo
- godot
- gosec
- testpackage
path: _test\.go
paths:
- third_party$
- builtin$
- examples$
- cmd/playground
- cmd/miniscript
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 2 additions & 2 deletions api/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ const (
// btc-only edition firmware. It appears in the HID descriptor.
FirmwareDeviceProductStringBitBox02PlusBTCOnly = "BitBox02 Nova BTC-only"

// BootloaderDeviceProductStringBitBox02Multi is the product string of the "BitBox02 Plus" multi
// BootloaderDeviceProductStringBitBox02PlusMulti is the product string of the "BitBox02 Plus" multi
// edition bootloader. It appears in the HID descriptor.
BootloaderDeviceProductStringBitBox02PlusMulti = "BitBox02 Nova Multi bl"
// BootloaderDeviceProductStringBitBox02BTCOnly is the product string of the "BitBox02 Plus"
// BootloaderDeviceProductStringBitBox02PlusBTCOnly is the product string of the "BitBox02 Plus"
// btc-only edition bootloader. It appears in the HID descriptor and the Bluetooth
// characteristic.
BootloaderDeviceProductStringBitBox02PlusBTCOnly = "BitBox02 Nova BTC-only bl"
Expand Down
4 changes: 2 additions & 2 deletions api/firmware/attestation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func makeCertificate(rootPrivkey *btcec.PrivateKey, bootloaderHash []byte, devic
func p256PrivKeyFromBytes(k []byte) *ecdsa.PrivateKey {
priv := new(ecdsa.PrivateKey)
c := elliptic.P256()
priv.PublicKey.Curve = c
priv.Curve = c
priv.D = new(big.Int).SetBytes(k)
priv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k)
priv.X, priv.Y = c.ScalarBaseMult(k)
return priv
}

Expand Down
2 changes: 1 addition & 1 deletion api/firmware/psbt.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ func newBTCTxFromPSBT(
}, nil
}

// Sign a PSBT. If `options` is nil, the default options are used. The PSBT input signatures will be
// BTCSignPSBT signs a PSBT. If `options` is nil, the default options are used. The PSBT input signatures will be
// populated.
func (device *Device) BTCSignPSBT(
coin messages.BTCCoin,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/BitBoxSwiss/bitbox02-api-go

go 1.22
go 1.24

require (
github.com/benma/miniscript-go v0.0.0-20240226152043-f7c34099edf9
Expand Down
Loading