Skip to content

Commit 6dddcbe

Browse files
author
fletcher.fan
committed
fix lint workflow
1 parent 740d1a9 commit 6dddcbe

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ lint-sol:
5858
.PHONY: lint-sol
5959

6060
lint-go:
61+
go work sync
6162
make -C bindings lint
6263
make -C contracts lint-go
6364
make -C node lint

bindings/ast/canonicalize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func CanonicalizeASTIDs(in *solc.StorageLayout) *solc.StorageLayout {
4949
}
5050

5151
replaceAstID := matches[0][2]
52-
newType := strings.Replace(oldType, replaceAstID, strconv.Itoa(int(lastId)), 1)
52+
newType := strings.Replace(oldType, replaceAstID, strconv.FormatUint(uint64(lastId), 10), 1)
5353
typeRemappings[oldType] = newType
5454
lastId++
5555
}

build/.golangci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ linters:
140140
- goprintffuncname
141141
- depguard
142142
- gocyclo
143-
- exportloopref
144143
- sqlclosecheck
145144
- rowserrcheck
146145
- durationcheck
@@ -176,6 +175,10 @@ issues:
176175
- staticcheck
177176
text: "SA9003:"
178177

178+
- linters:
179+
- staticcheck
180+
text: "SA1019:"
181+
179182
# Exclude lll issues for long lines with go:generate
180183
- linters:
181184
- lll
@@ -199,6 +202,10 @@ issues:
199202
- gosec
200203
text: "G404"
201204

205+
- linters:
206+
- gosec
207+
text: "G115"
208+
202209
- linters:
203210
- wsl
204211
text: "return statements should not be cuddled if block has more than two lines"

build/lint.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
const (
1717
// GolangCIVersion to be used for linting.
18-
GolangCIVersion = "github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.1"
18+
GolangCIVersion = "github.com/golangci/golangci-lint/cmd/golangci-lint@latest"
1919
)
2020

2121
// GOBIN environment variable.
@@ -51,13 +51,18 @@ func main() {
5151
func lint(depth int64) {
5252
v := flag.Bool("v", false, "log verbosely")
5353

54+
// Ensure we use the correct Go toolchain
55+
env := os.Environ()
56+
env = append(env, "GOTOOLCHAIN=auto")
57+
5458
// Make sure GOLANGCI is downloaded and available.
5559
argsGet := []string{"install", GolangCIVersion}
5660
cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), argsGet...)
61+
cmd.Env = env
5762

5863
out, err := cmd.CombinedOutput()
5964
if err != nil {
60-
log.Fatalf("could not list pkgs: %v\n%s", err, string(out))
65+
log.Fatalf("could not install golangci-lint: %v\n%s", err, string(out))
6166
}
6267

6368
cmd = exec.Command(filepath.Join(goBin(), "golangci-lint"))
@@ -72,10 +77,13 @@ func lint(depth int64) {
7277
cmd.Args = append(cmd.Args, "-v")
7378
}
7479

80+
// Set environment for golangci-lint
81+
cmd.Env = env
82+
7583
fmt.Println("Linting...")
7684
cmd.Stderr, cmd.Stdout = os.Stderr, os.Stdout
7785

7886
if err := cmd.Run(); err != nil {
79-
log.Fatal("Error: Could not Lint ", "error: ", err, ", cmd: ", cmd)
87+
log.Fatal("Error: Could not Lint ", "error", err, ", cmd", cmd)
8088
}
8189
}

tx-submitter/mock/l2client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (l *L2ClientWrapper) CallContract(ctx context.Context, msg ethereum.CallMsg
5353
}
5454

5555
// If calling the sequencer set method, return the mock sequencer set
56-
if msg.Data != nil && len(msg.Data) >= 4 {
56+
if len(msg.Data) >= 4 {
5757
methodID := msg.Data[:4]
5858
// Method ID for GetSequencerSet2()
5959
if string(methodID) == "\x77\xd7\xdf\xfb" {

0 commit comments

Comments
 (0)