ci: Test with Go 1.23 and 1.24 (#502)

In CI, test with Go 1.23 and 1.24,
and upgrade the Hermit-managed Go and golangci-lint to latest versions.

The new golangci-lint had a number of warnings and minor issues
that were either fixed or opted-out of.
This commit is contained in:
Abhinav Gupta
2025-02-16 19:10:57 -08:00
committed by GitHub
parent cab639ab83
commit 9f71a49767
13 changed files with 24 additions and 34 deletions
+6 -9
View File
@@ -15,12 +15,10 @@ func TestMultipleConfigLoading(t *testing.T) {
}
cli.Flag = "first"
first, cleanFirst := makeConfig(t, &cli)
defer cleanFirst()
first := makeConfig(t, &cli)
cli.Flag = ""
second, cleanSecond := makeConfig(t, &cli)
defer cleanSecond()
second := makeConfig(t, &cli)
p := mustNew(t, &cli, kong.Configuration(kong.JSON, first, second))
_, err := p.Parse(nil)
@@ -34,20 +32,19 @@ func TestConfigValidation(t *testing.T) {
}
cli.Flag = "invalid"
conf, cleanConf := makeConfig(t, &cli)
defer cleanConf()
conf := makeConfig(t, &cli)
p := mustNew(t, &cli, kong.Configuration(kong.JSON, conf))
_, err := p.Parse(nil)
assert.Error(t, err)
}
func makeConfig(t *testing.T, config any) (path string, cleanup func()) {
func makeConfig(t *testing.T, config any) (path string) {
t.Helper()
w, err := os.CreateTemp("", "")
w, err := os.CreateTemp(t.TempDir(), "")
assert.NoError(t, err)
defer w.Close()
err = json.NewEncoder(w).Encode(config)
assert.NoError(t, err)
return w.Name(), func() { os.Remove(w.Name()) }
return w.Name()
}