Skip to content

Commit c31e857

Browse files
authored
Merge pull request #301 from lets-cli/codex/update-lets-to-go-126
Update Go toolchain to 1.26
2 parents 549f361 + e2508bd commit c31e857

35 files changed

Lines changed: 244 additions & 113 deletions

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
github_token: ${{ secrets.GITHUB_TOKEN }}
3434
publish_dir: ./docs/build
3535
user_name: github-actions[bot]
36-
user_email: 41898282+github-actions[bot]@users.noreply.github.com
36+
user_email: 41898282+github-actions[bot]@users.noreply.github.com

.github/workflows/release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ jobs:
1313
- name: Unshallow
1414
run: git fetch --prune --unshallow
1515
- name: Set up Go
16-
uses: actions/setup-go@v1
16+
uses: actions/setup-go@v6
1717
with:
18-
go-version: 1.24.x
18+
go-version: 1.26.x
1919
- name: Run GoReleaser (dry run)
2020
env:
2121
PACKAGE_NAME: github.com/lets-cli/lets
22-
GOLANG_CROSS_VERSION: v1.24
22+
GOLANG_CROSS_VERSION: v1.26
2323
run: |
2424
docker run \
2525
--rm \
@@ -33,7 +33,7 @@ jobs:
3333
- name: Run GoReleaser
3434
env:
3535
PACKAGE_NAME: github.com/lets-cli/lets
36-
GOLANG_CROSS_VERSION: v1.24
36+
GOLANG_CROSS_VERSION: v1.26
3737
run: |
3838
docker run \
3939
--rm \

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
if: runner.os == 'macOS'
2121
run: brew install bash
2222
- name: Setup go
23-
uses: actions/setup-go@v2
23+
uses: actions/setup-go@v6
2424
with:
25-
go-version: 1.24.x
25+
go-version: 1.26.x
2626
- name: Checkout code
2727
uses: actions/checkout@v2
2828
- run: go install gotest.tools/gotestsum@latest

.golangci.yaml

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,64 @@
1+
version: "2"
12
run:
3+
go: "1.26"
24
tests: false
3-
go: "1.23"
4-
55
linters:
6-
enable-all: true
6+
default: all
77
disable:
8-
- typecheck
9-
- gomoddirectives
108
- containedctx
11-
- gochecknoglobals
12-
- goimports
13-
- funlen
14-
- godox
15-
- maligned
16-
- goerr113
17-
- exhaustivestruct
18-
- wrapcheck
19-
- prealloc # enable it sometimes
20-
- wsl
21-
- ifshort
22-
- unparam
9+
- copyloopvar
2310
- cyclop
24-
- gocyclo
11+
- depguard
12+
- err113
13+
- exhaustive
14+
- exhaustruct
15+
- forcetypeassert
16+
- funlen
17+
- funcorder
18+
- gochecknoglobals
2519
- gocognit
26-
- tagliatelle
27-
- nestif
28-
- nlreturn
20+
- gocritic
21+
- gocyclo
22+
- godoclint
23+
- godox
24+
- gomoddirectives
2925
- goprintffuncname
30-
- exhaustruct
31-
- wastedassign
26+
- gosec
27+
- importas
28+
- lll
29+
- mnd
30+
- musttag
31+
- nestif
3232
- nilnil
33+
- noctx
34+
- noinlineerr
35+
- nlreturn
36+
- prealloc
3337
- recvcheck
34-
- musttag
35-
- mnd
36-
- lll
37-
- gocritic
38-
- forcetypeassert
39-
- exhaustive
40-
- depguard
4138
- revive
42-
- gosec
43-
- copyloopvar
44-
45-
linters-settings:
46-
lll:
47-
line-length: 120
48-
varnamelen:
49-
min-name-length: 1
50-
51-
issues:
52-
exclude-rules:
53-
- path: _test\.go
54-
linters:
55-
- gomnd
56-
- path: set\.go
57-
linters:
58-
- typecheck
39+
- tagliatelle
40+
- unparam
41+
- wastedassign
42+
- wrapcheck
43+
- whitespace
44+
- wsl
45+
settings:
46+
lll:
47+
line-length: 120
48+
varnamelen:
49+
min-name-length: 1
50+
exclusions:
51+
generated: lax
52+
presets:
53+
- comments
54+
- common-false-positives
55+
- legacy
56+
- std-error-handling
57+
rules:
58+
- linters:
59+
- mnd
60+
path: _test\.go
61+
paths:
62+
- third_party$
63+
- builtin$
64+
- examples$

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-bookworm AS builder
1+
FROM golang:1.26-bookworm AS builder
22

33
ENV GOPROXY=https://proxy.golang.org
44
ENV CGO_ENABLED=1
@@ -26,6 +26,6 @@ COPY go.sum .
2626

2727
RUN go mod download
2828

29-
FROM golangci/golangci-lint:v1.64.7-alpine AS linter
29+
FROM golangci/golangci-lint:v2.11.3-alpine AS linter
3030

3131
RUN mkdir -p /.cache && chmod -R 777 /.cache

cmd/lets/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func main() {
5555
log.Errorf("lets: print version error: %s", err)
5656
os.Exit(1)
5757
}
58+
5859
os.Exit(0)
5960
}
6061

@@ -116,6 +117,7 @@ func main() {
116117
log.Errorf("lets: print help error: %s", err)
117118
os.Exit(1)
118119
}
120+
119121
os.Exit(0)
120122
}
121123

@@ -198,7 +200,9 @@ func parseRootFlags(args []string) (*flags, error) {
198200
if visited.Contains(name) {
199201
return true
200202
}
203+
201204
visited.Add(name)
205+
202206
return false
203207
}
204208

@@ -218,10 +222,12 @@ func parseRootFlags(args []string) (*flags, error) {
218222
if value == "" {
219223
return nil, errors.New("--config must be set to value")
220224
}
225+
221226
f.config = value
222227
} else if len(args[idx:]) > 0 {
223228
f.config = args[idx+1]
224229
idx += 2
230+
225231
continue
226232
}
227233
}

docs/docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Changelog
55

66
## [Unreleased](https://github.com/lets-cli/lets/releases/tag/v0.0.X)
77

8+
* `[Dependency]` update go to `1.26`
89
* `[Added]` Show similar command suggestions on typos.
910
* `[Changed]` Exit code 2 on unknown command.
1011
* `[Added]` Expose `LETS_OS` and `LETS_ARCH` environment variables at command runtime.

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/lets-cli/lets
22

3-
go 1.24
3+
go 1.26
4+
5+
toolchain go1.26.0
46

57
require (
68
github.com/codeclysm/extract v2.2.0+incompatible

internal/checksum/checksum.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ func CalculateChecksum(workDir string, patterns []string) (string, error) {
7272
if err != nil {
7373
return "", fmt.Errorf("can not read file to calculate checksum: %w", err)
7474
}
75+
7576
cachedSum = fileHasher.Sum(data)
7677
checksumCache[filename] = cachedSum
78+
7779
_, err = hasher.Write(cachedSum)
7880
if err != nil {
7981
return "", fmt.Errorf("can not write checksum to hasher: %w", err)
8082
}
83+
8184
fileHasher.Reset()
8285
}
8386
}
@@ -175,6 +178,7 @@ func PersistCommandsChecksumToDisk(checksumsDir string, checksumMap map[string]s
175178
if checksumName == DefaultChecksumKey {
176179
filename = DefaultChecksumFileName
177180
}
181+
178182
err := persistOneChecksum(checksumsDir, cmdName, filename, checksum)
179183
if err != nil {
180184
return err

internal/cmd/completion.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func getCommandsList(rootCmd *cobra.Command, out io.Writer, verbose bool) error
112112
descr = strings.TrimSpace(descr)
113113
}
114114

115-
buf.WriteString(fmt.Sprintf("%s:%s\n", cmd.Name(), descr))
115+
fmt.Fprintf(buf, "%s:%s\n", cmd.Name(), descr)
116116
} else {
117117
buf.WriteString(cmd.Name() + "\n")
118118
}
@@ -165,7 +165,7 @@ func getCommandOptions(command *config.Command, out io.Writer, verbose bool) err
165165
desc = strings.TrimSpace(option.desc)
166166
}
167167

168-
buf.WriteString(fmt.Sprintf("%[1]s[%s]\n", option.name, desc))
168+
fmt.Fprintf(buf, "%[1]s[%s]\n", option.name, desc)
169169
} else {
170170
buf.WriteString(option.name + "\n")
171171
}
@@ -249,6 +249,7 @@ func InitCompletionCmd(rootCmd *cobra.Command, cfg *config.Config) func(cfg *con
249249
}
250250

251251
completionCmd.Flags().StringP("shell", "s", "", "The type of shell (bash or zsh)")
252+
252253
if cfg != nil {
253254
completionCmd.Flags().Bool("list", false, "Show list of commands [deprecated, use --commands]")
254255
completionCmd.Flags().Bool("commands", false, "Show list of commands")

0 commit comments

Comments
 (0)