From ce6f3f625c8d042bab9f9725a226e513694ae726 Mon Sep 17 00:00:00 2001 From: Lexer747 Date: Fri, 21 Aug 2026 17:52:59 +0100 Subject: [PATCH 1/4] version bumps --- .github/workflows/ci.yml | 10 +++++----- go.mod | 17 +++++++---------- go.sum | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a2d75c..bbcaee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v6 with: - go-version: '1.26' + go-version: '1.27' - name: Build run: ./tools/build.sh @@ -29,7 +29,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v6 with: - go-version: '1.26' + go-version: '1.27' - name: Test run: go test -race ./... @@ -44,11 +44,11 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-go@v6 with: - go-version: '1.26' + go-version: '1.27' - name: golangci-lint uses: golangci/golangci-lint-action@v9 with: - version: v2.11.4 + version: v2.13.1 verify: false # This linter works based on the file modification when running under github actions because it's # not given full access to the git history and therefore gets the wrong date for all files. @@ -63,7 +63,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v6 with: - go-version: '1.26' + go-version: '1.27' - name: install fieldalignment run: go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest diff --git a/go.mod b/go.mod index 951e6a7..2c82c01 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,22 @@ module github.com/Lexer747/acci-ping -go 1.26.0 - -require ( - golang.org/x/exp v0.0.0-20260718201538-764159d718ef - golang.org/x/net v0.57.0 - golang.org/x/term v0.45.0 -) +go 1.27 // Test dependencies require ( github.com/google/go-cmp v0.7.0 + golang.org/x/exp v0.0.0-20260820142414-ca536658362e + golang.org/x/net v0.58.0 + golang.org/x/term v0.45.0 gotest.tools/v3 v3.5.2 - pgregory.net/rapid v1.2.0 + pgregory.net/rapid v1.3.0 ) require ( - golang.org/x/mod v0.38.0 // indirect + golang.org/x/mod v0.40.0 // indirect golang.org/x/sync v0.22.0 // indirect golang.org/x/sys v0.47.0 // indirect - golang.org/x/tools v0.48.0 // indirect + golang.org/x/tools v0.49.0 // indirect ) tool golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment diff --git a/go.sum b/go.sum index ab12abc..82b6b55 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,20 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/exp v0.0.0-20260718201538-764159d718ef h1:LkZ48HFgy/TvhTI0bcWkjgFkgLyKUwcTbDjS0DUjw+A= -golang.org/x/exp v0.0.0-20260718201538-764159d718ef/go.mod h1:EdfpwwqSu+0Li0mzskwHU6FWDV3t9Q+RZDo3QMUtL3Q= -golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= -golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/exp v0.0.0-20260820142414-ca536658362e h1:01Ju2A/fZKkci4zqx0eZxw//DnRYOnBiGJG14hFBhO8= +golang.org/x/exp v0.0.0-20260820142414-ca536658362e/go.mod h1:zeBbvyFKDaLwa7CH/zI8KXt7gTl14SF7sO08Pl5jBCM= +golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= +golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= +golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= +golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= -golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= -golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= +golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= -pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= -pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pgregory.net/rapid v1.3.0 h1:vBvO0VSqti75J1jjYqpgPNBLKMd1+gxa9fYo7vk/Exc= +pgregory.net/rapid v1.3.0/go.mod h1:dPlE4OBBxgXPqkP79flB6sJL1dx5azpI7HQ9MY9Z7uk= From 59422d2253cb630f4286805665edf0ff4f70a67d Mon Sep 17 00:00:00 2001 From: Lexer747 Date: Fri, 21 Aug 2026 17:54:22 +0100 Subject: [PATCH 2/4] embedlit --- cmd/subcommands/acci-ping/application.go | 6 ++---- cmd/terminal/main.go | 8 +++----- terminal/terminal.go | 6 ++---- terminal/terminal_test.go | 22 +++++++++------------- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/cmd/subcommands/acci-ping/application.go b/cmd/subcommands/acci-ping/application.go index 7f154c8..a53d666 100644 --- a/cmd/subcommands/acci-ping/application.go +++ b/cmd/subcommands/acci-ping/application.go @@ -296,10 +296,8 @@ func (app *Application) addListener(r rune, Action func(rune) error) { panic(fmt.Sprintf("Adding more than one listener for '%v'", r)) } app.listeningChars[r] = terminal.ConditionalListener{ - Listener: terminal.Listener{ - Action: Action, - Name: "GUI Listener " + strconv.QuoteRune(r), - }, + Action: Action, + Name: "GUI Listener " + strconv.QuoteRune(r), Applicable: func(in rune) bool { return in == r }, diff --git a/cmd/terminal/main.go b/cmd/terminal/main.go index d648373..f0d0896 100644 --- a/cmd/terminal/main.go +++ b/cmd/terminal/main.go @@ -48,11 +48,9 @@ func main() { Applicable: func(r rune) bool { return r == 'l' }, - Listener: terminal.Listener{ - Name: "clear", - Action: func(rune) error { - return t.ClearScreen(terminal.UpdateSize) - }, + Name: "clear", + Action: func(rune) error { + return t.ClearScreen(terminal.UpdateSize) }, } // Actually start the terminal program. Note that the listeners are applied in order, so if more than one diff --git a/terminal/terminal.go b/terminal/terminal.go index 4746065..bfe9fb2 100644 --- a/terminal/terminal.go +++ b/terminal/terminal.go @@ -270,10 +270,8 @@ func (t *Terminal) StartRaw( controlCListener := ConditionalListener{ Applicable: func(r rune) bool { return r == '\x03' }, - Listener: Listener{ - Name: "ctrl+c", - Action: ctrlCAction, - }, + Name: "ctrl+c", + Action: ctrlCAction, } t.listeners = slices.Concat(t.listeners, []ConditionalListener{controlCListener}, listeners) if fallbacks != nil { diff --git a/terminal/terminal_test.go b/terminal/terminal_test.go index 18862ea..93551d8 100644 --- a/terminal/terminal_test.go +++ b/terminal/terminal_test.go @@ -61,13 +61,11 @@ func TestTerminalListener(t *testing.T) { lastRune = r return true }, - Listener: terminal.Listener{ - Action: func(r rune) error { - assert.Equal(t, lastRune, r) - err := term.Print(string(r)) - assert.NilError(t, err) - return nil - }, + Action: func(r rune) error { + assert.Equal(t, lastRune, r) + err := term.Print(string(r)) + assert.NilError(t, err) + return nil }, } _, err = term.StartRaw(ctx, cancelFunc, []terminal.ConditionalListener{testListener}, nil) @@ -105,12 +103,10 @@ func TestTerminalFallbackListener(t *testing.T) { Applicable: func(r rune) bool { return r == 'a' }, - Listener: terminal.Listener{ - Action: func(r rune) error { - <-m1 - m2 <- struct{}{} - return nil - }, + Action: func(r rune) error { + <-m1 + m2 <- struct{}{} + return nil }, } fallback := terminal.Listener{ From 01e164d0e0f10ee01bca70323fe01a0ac899dfda Mon Sep 17 00:00:00 2001 From: Lexer747 Date: Fri, 21 Aug 2026 17:56:29 +0100 Subject: [PATCH 3/4] deprecated linter --- .golangci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.golangci.yaml b/.golangci.yaml index ebf9ca4..8c4f681 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -17,6 +17,7 @@ linters: - gocritic - godot - godox + - gomodguard # 'gomodguard' is deprecated - ireturn - mnd - nlreturn From a0caf4486b04dfd10f5b0fde8de91ca6c0f0bf92 Mon Sep 17 00:00:00 2001 From: Lexer747 Date: Fri, 21 Aug 2026 18:01:57 +0100 Subject: [PATCH 4/4] lint fixes --- .golangci.yaml | 1 + cmd/tab_completion/tab_completion_test.go | 5 +++-- cmd/terminal/main.go | 2 +- terminal/terminal_test.go | 2 +- utils/sliceutils/sliceutils.go | 6 ++++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 8c4f681..80635d0 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -10,6 +10,7 @@ linters: - embeddedstructfieldcheck # we use [fieldalignment] instead - errname - exhaustruct + - exhaustruct_v5 # To be re-enabled once fixed https://github.com/GaijinEntertainment/go-exhaustruct/issues/168 - forbidigo - funlen - gochecknoglobals diff --git a/cmd/tab_completion/tab_completion_test.go b/cmd/tab_completion/tab_completion_test.go index 0e61f8d..561d34e 100644 --- a/cmd/tab_completion/tab_completion_test.go +++ b/cmd/tab_completion/tab_completion_test.go @@ -1,6 +1,6 @@ // Use of this source code is governed by a GPL-2 license that can be found in the LICENSE file. // -// Copyright 2025 Lexer747 +// Copyright 2025-2026 Lexer747 // // SPDX-License-Identifier: GPL-2.0-only @@ -32,6 +32,7 @@ var subCommands = []Command{ make_version_Flags(), } +//nolint:goconst // constants are not desirable here func TestGetChoices(t *testing.T) { t.Parallel() t.Run("tab", func(t *testing.T) { @@ -179,7 +180,7 @@ type boolFlag interface { IsBoolFlag() bool } -//nolint:staticcheck +//nolint:staticcheck // ST1003 underscores are fine here we want casing to be correct for the command func make_acciping_Flags() Command { f := flag.NewFlagSet("", flag.ContinueOnError) tf := tabflags.NewAutoCompleteFlagSet(f, false, "") diff --git a/cmd/terminal/main.go b/cmd/terminal/main.go index f0d0896..9378aa0 100644 --- a/cmd/terminal/main.go +++ b/cmd/terminal/main.go @@ -1,6 +1,6 @@ // Use of this source code is governed by a GPL-2 license that can be found in the LICENSE file. // -// Copyright 2024-2025 Lexer747 +// Copyright 2024-2026 Lexer747 // // SPDX-License-Identifier: GPL-2.0-only diff --git a/terminal/terminal_test.go b/terminal/terminal_test.go index 93551d8..7f2c069 100644 --- a/terminal/terminal_test.go +++ b/terminal/terminal_test.go @@ -1,6 +1,6 @@ // Use of this source code is governed by a GPL-2 license that can be found in the LICENSE file. // -// Copyright 2024-2025 Lexer747 +// Copyright 2024-2026 Lexer747 // // SPDX-License-Identifier: GPL-2.0-only diff --git a/utils/sliceutils/sliceutils.go b/utils/sliceutils/sliceutils.go index 84bed7c..6a36410 100644 --- a/utils/sliceutils/sliceutils.go +++ b/utils/sliceutils/sliceutils.go @@ -1,6 +1,6 @@ // Use of this source code is governed by a GPL-2 license that can be found in the LICENSE file. // -// Copyright 2024-2025 Lexer747 +// Copyright 2024-2026 Lexer747 // // SPDX-License-Identifier: GPL-2.0-only @@ -50,7 +50,8 @@ func Fold[IN, OUT any, S ~[]IN](slice S, base OUT, f func(IN, OUT) OUT) OUT { } // Shuffle uses [rand.Shuffle] to shuffle all the elements of the [slice] and return a shuffled [clone] of the -// input. +// input. This is not a secure shuffle as it uses a weak number generator do not call for security sensitive +// code. func Shuffle[S ~[]T, T any](slice S) S { ret := slices.Clone(slice) shuf := func(i, j int) { @@ -58,6 +59,7 @@ func Shuffle[S ~[]T, T any](slice S) S { ret[i] = ret[j] ret[j] = t } + //nolint:gosec // G404 this is not a security safe function and is declared as such above rand.Shuffle(len(ret), shuf) return ret }