Skip to content

Commit 55af94b

Browse files
authored
Merge pull request #638 from CosmWasm/aw/update-tooling
Update Go and Nix tooling to latest versions
2 parents 0a9d7fe + a2314b6 commit 55af94b

File tree

16 files changed

+107
-78
lines changed

16 files changed

+107
-78
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/lint-go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
go-version: "1.23.4"
2424
cache: false
2525
- name: golangci-lint
26-
uses: golangci/golangci-lint-action@v6
26+
uses: golangci/golangci-lint-action@v7
2727
with:
2828
# Require: The version of golangci-lint to use.
2929
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
3030
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
31-
version: v1.62.2
31+
version: v2.1
3232

3333
# Optional: working directory, useful for monorepos
3434
# working-directory: somedir

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ a.out
1616

1717
# macOS
1818
.DS_Store
19+
20+
# direnv Nix stuff
21+
.direnv/

.golangci.yml

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,62 @@
1+
version: "2"
2+
13
run:
24
tests: true
35

46
linters:
5-
# Enable specific linter
7+
# Enable specific linters
68
# https://golangci-lint.run/usage/linters/#enabled-by-default
79
enable:
8-
- gofumpt
9-
- gci
10+
- misspell
1011
- testifylint
11-
- errcheck
1212
- thelper
13-
14-
linters-settings:
15-
gci:
16-
# Section configuration to compare against.
17-
# Section names are case-insensitive and may contain parameters in ().
18-
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
19-
# If `custom-order` is `true`, it follows the order of `sections` option.
20-
# Default: ["standard", "default"]
21-
sections:
22-
- standard # Standard section: captures all standard packages.
23-
- default # Default section: contains all imports that could not be matched to another section type.
24-
- prefix(github.com/cosmos/cosmos-sdk) # Custom section: groups all imports with the specified Prefix.
25-
- prefix(github.com/cosmos/ibc-go)
26-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
27-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
28-
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
29-
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
30-
# Skip generated files.
31-
# Default: true
32-
skip-generated: false
33-
# Enable custom order of sections.
34-
# If `true`, make the section order the same as the order of `sections`.
35-
# Default: false
36-
custom-order: true
37-
# Drops lexical ordering for custom sections.
38-
# Default: false
39-
no-lex-order: true
13+
exclusions:
14+
generated: lax
15+
presets:
16+
- comments
17+
- common-false-positives
18+
- legacy
19+
- std-error-handling
20+
paths:
21+
- third_party$
22+
- builtin$
23+
- examples$
4024

4125
issues:
4226
max-issues-per-linter: 0
4327
max-same-issues: 0
28+
29+
formatters:
30+
enable:
31+
- gci
32+
- gofumpt
33+
settings:
34+
gci:
35+
# Section configuration to compare against.
36+
# Section names are case-insensitive and may contain parameters in ().
37+
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
38+
# If `custom-order` is `true`, it follows the order of `sections` option.
39+
# Default: ["standard", "default"]
40+
sections:
41+
- standard # Standard section: captures all standard packages.
42+
- default # Default section: contains all imports that could not be matched to another section type.
43+
- prefix(github.com/cosmos/cosmos-sdk) # Custom section: groups all imports with the specified Prefix.
44+
- prefix(github.com/cosmos/ibc-go)
45+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
46+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
47+
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
48+
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
49+
# Enable custom order of sections.
50+
# If `true`, make the section order the same as the order of `sections`.
51+
# Default: false
52+
custom-order: true
53+
# Drops lexical ordering for custom sections.
54+
# Default: false
55+
no-lex-order: true
56+
exclusions:
57+
# Skip generated files.
58+
generated: lax
59+
paths:
60+
- third_party$
61+
- builtin$
62+
- examples$

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ test-alpine: release-build-alpine create-tester-image
148148

149149
.PHONY: format
150150
format:
151-
find . -name '*.go' -type f | xargs gofumpt -w -s
152-
find . -name '*.go' -type f | xargs misspell -w
151+
find . -name '*.go' -type f | xargs gofumpt -w
153152

154153
.PHONY: lint
155154
lint:

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
inputs = {
55
flake-utils.url = "github:numtide/flake-utils";
6-
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
77
rust-overlay = {
88
inputs = {
99
flake-utils.follows = "flake-utils";
@@ -13,16 +13,23 @@
1313
};
1414
};
1515

16-
outputs = { self, nixpkgs, flake-utils, rust-overlay } @ inputs:
17-
flake-utils.lib.eachDefaultSystem (system:
16+
outputs =
17+
{
18+
self,
19+
nixpkgs,
20+
flake-utils,
21+
rust-overlay,
22+
}@inputs:
23+
flake-utils.lib.eachDefaultSystem (
24+
system:
1825
let
1926
overlays = [ (import rust-overlay) ];
2027
pkgs = import nixpkgs {
2128
inherit overlays system;
2229
};
2330
in
2431
{
25-
formatter = pkgs.nixpkgs-fmt;
32+
formatter = pkgs.nixfmt-rfc-style;
2633

2734
devShells.default = pkgs.mkShell {
2835
buildInputs = with pkgs; [

ibc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ func TestAnalyzeCode(t *testing.T) {
302302
report, err := vm.AnalyzeCode(checksum)
303303
require.NoError(t, err)
304304
require.False(t, report.HasIBCEntryPoints)
305-
require.Equal(t, "", report.RequiredCapabilities)
305+
require.Empty(t, report.RequiredCapabilities)
306306
require.Equal(t, uint64(42), *report.ContractMigrateVersion)
307307

308308
// Store IBC contract

internal/api/iterator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func storeIterator(callID uint64, it types.Iterator, frameLenLimit int) (uint64,
6565

6666
new_index := len(iteratorFrames[callID])
6767
if new_index >= frameLenLimit {
68-
return 0, fmt.Errorf("Reached iterator limit (%d)", frameLenLimit)
68+
return 0, fmt.Errorf("reached iterator limit (%d)", frameLenLimit)
6969
}
7070

7171
// store at array position `new_index`

internal/api/iterator_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func TestStoreIteratorHitsLimit(t *testing.T) {
117117

118118
iter, _ = store.Iterator(nil, nil)
119119
_, err = storeIterator(callID, iter, limit)
120-
require.ErrorContains(t, err, "Reached iterator limit (2)")
120+
require.ErrorContains(t, err, "reached iterator limit (2)")
121121

122122
endCall(callID)
123123
}
@@ -192,7 +192,7 @@ func TestQueueIteratorSimple(t *testing.T) {
192192
var qResult types.QueryResult
193193
err = json.Unmarshal(data, &qResult)
194194
require.NoError(t, err)
195-
require.Equal(t, "", qResult.Err)
195+
require.Empty(t, qResult.Err)
196196
require.Equal(t, `{"sum":39}`, string(qResult.Ok))
197197

198198
// query reduce (multiple iterators at once)
@@ -202,7 +202,7 @@ func TestQueueIteratorSimple(t *testing.T) {
202202
var reduced types.QueryResult
203203
err = json.Unmarshal(data, &reduced)
204204
require.NoError(t, err)
205-
require.Equal(t, "", reduced.Err)
205+
require.Empty(t, reduced.Err)
206206
require.JSONEq(t, `{"counters":[[17,22],[22,0]]}`, string(reduced.Ok))
207207
}
208208

@@ -231,7 +231,7 @@ func TestQueueIteratorRaces(t *testing.T) {
231231
var reduced types.QueryResult
232232
err = json.Unmarshal(data, &reduced)
233233
require.NoError(t, err)
234-
require.Equal(t, "", reduced.Err)
234+
require.Empty(t, reduced.Err)
235235
require.Equal(t, fmt.Sprintf(`{"counters":%s}`, expected), string(reduced.Ok))
236236
}
237237

@@ -283,7 +283,7 @@ func TestQueueIteratorLimit(t *testing.T) {
283283
require.NoError(t, err)
284284
err = json.Unmarshal(data, &qResult)
285285
require.NoError(t, err)
286-
require.Equal(t, "", qResult.Err)
286+
require.Empty(t, qResult.Err)
287287
require.Equal(t, `{}`, string(qResult.Ok))
288288

289289
// Open 35000 iterators
@@ -294,5 +294,5 @@ func TestQueueIteratorLimit(t *testing.T) {
294294
query = []byte(`{"open_iterators":{"count":35000}}`)
295295
env = MockEnvBin(t)
296296
_, _, err = Query(cache, checksum, env, query, &igasMeter, store, api, &querier, gasLimit, TESTING_PRINT_DEBUG)
297-
require.ErrorContains(t, err, "Reached iterator limit (32768)")
297+
require.ErrorContains(t, err, "reached iterator limit (32768)")
298298
}

0 commit comments

Comments
 (0)