Skip to content

Commit

Permalink
[build] Update linter version (#3024)
Browse files Browse the repository at this point in the history
Signed-off-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com>
Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
  • Loading branch information
tsachiherman and StephenButtolph authored May 19, 2024
1 parent ddd6d25 commit cab15c0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
run:
timeout: 10m

# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
skip-dirs-use-default: false

# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand Down Expand Up @@ -36,6 +31,11 @@ issues:
# Default: 3
max-same-issues: 0

# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
exclude-dirs-use-default: false

linters:
disable-all: true
enable:
Expand Down
3 changes: 1 addition & 2 deletions network/peer/tls_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
// It is safe, and typically expected, for [keyLogWriter] to be [nil].
// [keyLogWriter] should only be enabled for debugging.
func TLSConfig(cert tls.Certificate, keyLogWriter io.Writer) *tls.Config {
// #nosec G402
return &tls.Config{
Certificates: []tls.Certificate{cert},
ClientAuth: tls.RequireAnyClientCert,
Expand All @@ -24,7 +23,7 @@ func TLSConfig(cert tls.Certificate, keyLogWriter io.Writer) *tls.Config {
//
// During our security audit by Quantstamp, this was investigated
// and confirmed to be safe and correct.
InsecureSkipVerify: true,
InsecureSkipVerify: true, //#nosec G402
MinVersion: tls.VersionTLS13,
KeyLogWriter: keyLogWriter,
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
TESTS=${TESTS:-"golangci_lint license_header require_error_is_no_funcs_as_params single_import interface_compliance_nil require_no_error_inline_func"}

function test_golangci_lint {
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.1
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.1
golangci-lint run --config .golangci.yml
}

Expand Down
11 changes: 8 additions & 3 deletions vms/platformvm/txs/executor/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func TestNewImportTx(t *testing.T) {
require.NoError(t, err)

customAssetID := ids.GenerateTestID()

// generate a constant random source generator.
randSrc := rand.NewSource(0)
tests := []test{
{
description: "can't pay fee",
Expand All @@ -52,6 +53,7 @@ func TestNewImportTx(t *testing.T) {
map[ids.ID]uint64{
env.ctx.AVAXAssetID: env.config.TxFee - 1,
},
randSrc,
),
sourceKeys: []*secp256k1.PrivateKey{sourceKey},
expectedErr: builder.ErrInsufficientFunds,
Expand All @@ -67,6 +69,7 @@ func TestNewImportTx(t *testing.T) {
map[ids.ID]uint64{
env.ctx.AVAXAssetID: env.config.TxFee,
},
randSrc,
),
sourceKeys: []*secp256k1.PrivateKey{sourceKey},
expectedErr: nil,
Expand All @@ -82,6 +85,7 @@ func TestNewImportTx(t *testing.T) {
map[ids.ID]uint64{
env.ctx.AVAXAssetID: env.config.TxFee,
},
randSrc,
),
sourceKeys: []*secp256k1.PrivateKey{sourceKey},
timestamp: env.config.UpgradeConfig.ApricotPhase5Time,
Expand All @@ -99,6 +103,7 @@ func TestNewImportTx(t *testing.T) {
env.ctx.AVAXAssetID: env.config.TxFee,
customAssetID: 1,
},
randSrc,
),
sourceKeys: []*secp256k1.PrivateKey{sourceKey},
timestamp: env.config.UpgradeConfig.ApricotPhase5Time,
Expand Down Expand Up @@ -168,6 +173,7 @@ func fundedSharedMemory(
sourceKey *secp256k1.PrivateKey,
peerChain ids.ID,
assets map[ids.ID]uint64,
randSrc rand.Source,
) atomic.SharedMemory {
fundedSharedMemoryCalls++
m := atomic.NewMemory(prefixdb.New([]byte{fundedSharedMemoryCalls}, env.baseDB))
Expand All @@ -176,11 +182,10 @@ func fundedSharedMemory(
peerSharedMemory := m.NewSharedMemory(peerChain)

for assetID, amt := range assets {
// #nosec G404
utxo := &avax.UTXO{
UTXOID: avax.UTXOID{
TxID: ids.GenerateTestID(),
OutputIndex: rand.Uint32(),
OutputIndex: uint32(randSrc.Int63()),
},
Asset: avax.Asset{ID: assetID},
Out: &secp256k1fx.TransferOutput{
Expand Down
2 changes: 2 additions & 0 deletions vms/platformvm/txs/executor/standard_tx_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package executor
import (
"errors"
"math"
"math/rand"
"testing"
"time"

Expand Down Expand Up @@ -1185,6 +1186,7 @@ func TestDurangoMemoField(t *testing.T) {
map[ids.ID]uint64{
env.ctx.AVAXAssetID: sourceAmount,
},
rand.NewSource(0),
)
env.msm.SharedMemory = sharedMemory

Expand Down

0 comments on commit cab15c0

Please sign in to comment.