This is an automated email from the ASF dual-hosted git repository.
kichan pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new fa2de7b Upgrade Go to 1.25 (#337)
fa2de7b is described below
commit fa2de7bc8d3d9e065ed65b2765e233762aad5aa3
Author: Kit Chan <[email protected]>
AuthorDate: Fri Mar 20 05:15:28 2026 +0100
Upgrade Go to 1.25 (#337)
* Update Go version from 1.24.12 to 1.25.8
* Update Go version from 1.24.12 to 1.25.8
* Update golangci-lint action to version 9
* Downgrade golangci-lint action to version 6
* Downgrade golangci-lint action to v5
* Update golangci-lint action to version 6
* Upgrade golangci-lint-action to version 7
* Update golangci-lint configuration version and output
* Initial plan
* fix: update .golangci.yaml to golangci-lint v2 format
Co-authored-by: shukitchan <[email protected]>
* Fix golangci-lint v2 output.formats config: use map instead of slice
* Fix golangci-lint v2 output config format
* Remove 'gosimple' from enabled linters
* Initial plan
* Fix 9 golangci-lint findings (errcheck + staticcheck)
Co-authored-by: shukitchan <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot]
<[email protected]>
Co-authored-by: shukitchan <[email protected]>
---
.github/workflows/golangci-lint.yml | 4 ++--
.golangci.yaml | 16 +++++++++-------
GO_VERSION | 2 +-
go.mod | 2 +-
main/main.go | 4 ++--
redis/redis.go | 10 +++++-----
util/util.go | 2 +-
watcher/handlerCache.go | 2 +-
8 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/.github/workflows/golangci-lint.yml
b/.github/workflows/golangci-lint.yml
index 678954d..56b3080 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -52,8 +52,8 @@ jobs:
with:
go-version: ${{ steps.go-version.outputs.value }}
- name: golangci-lint
- uses: golangci/golangci-lint-action@v5
+ uses: golangci/golangci-lint-action@v7
with:
- version: latest
+ version: v2.4.0
args: --timeout=10m
diff --git a/.golangci.yaml b/.golangci.yaml
index 4c90a48..cdb9a48 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -14,12 +14,13 @@
# limitations under the License.
#
+version: "2"
+
# https://golangci-lint.run/usage/linters/
linters:
- disable-all: true
+ default: none
enable:
- errcheck
- - gosimple
- govet
- ineffassign
- staticcheck
@@ -31,8 +32,9 @@ run:
timeout: 5m
tests: false
- output:
- format: colored-line-number
- print-issued-lines: true
- print-linter-name: true
-
+output:
+ formats:
+ text:
+ path: stdout
+ print-issued-lines: true
+ print-linter-name: true
diff --git a/GO_VERSION b/GO_VERSION
index 5c854ab..e6a6e7c 100644
--- a/GO_VERSION
+++ b/GO_VERSION
@@ -1 +1 @@
-1.24.12
+1.25.8
diff --git a/go.mod b/go.mod
index fbfdcb3..fe85fe1 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/apache/trafficserver-ingress-controller
-go 1.24.12
+go 1.25.8
require (
github.com/alicebob/miniredis/v2 v2.31.1
diff --git a/main/main.go b/main/main.go
index da8949e..c6c77b1 100644
--- a/main/main.go
+++ b/main/main.go
@@ -78,7 +78,7 @@ func main() {
// default namespace to "all"
if *namespaces != namespace.ALL {
- namespaceList :=
strings.Split(strings.Replace(strings.ToLower(*namespaces), " ", "", -1), ",")
+ namespaceList :=
strings.Split(strings.ReplaceAll(strings.ToLower(*namespaces), " ", ""), ",")
for _, namespace := range namespaceList {
if namespace != "" {
namespaceMap[namespace] = true
@@ -89,7 +89,7 @@ func main() {
ignoreNamespaceMap = make(map[string]bool)
if *ignoreNamespaces != "" {
- ignoreNamespaceList :=
strings.Split(strings.Replace(strings.ToLower(*ignoreNamespaces), " ", "", -1),
",")
+ ignoreNamespaceList :=
strings.Split(strings.ReplaceAll(strings.ToLower(*ignoreNamespaces), " ", ""),
",")
for _, namespace := range ignoreNamespaceList {
if namespace != "" {
ignoreNamespaceMap[namespace] = true
diff --git a/redis/redis.go b/redis/redis.go
index 11a7647..91c6b03 100644
--- a/redis/redis.go
+++ b/redis/redis.go
@@ -45,11 +45,11 @@ const (
func Init() (*Client, error) {
rClient, err := CreateRedisClient() // connecting to redis
if err != nil {
- return nil, fmt.Errorf("Failed connecting to Redis: %s",
err.Error())
+ return nil, fmt.Errorf("failed connecting to Redis: %s",
err.Error())
}
err = rClient.Flush() // when the program starts, flush all stale memory
if err != nil {
- return nil, fmt.Errorf("Failed to FlushAll: %s", err.Error())
+ return nil, fmt.Errorf("failed to FlushAll: %s", err.Error())
}
return rClient, nil
}
@@ -189,8 +189,8 @@ func (c *Client) Flush() error {
// Close tries to close the 2 clients
func (c *Client) Close() {
- c.DefaultDB.Close()
- c.DBOne.Close()
+ _ = c.DefaultDB.Close()
+ _ = c.DBOne.Close()
// for garbage collector
c.DefaultDB = nil
c.DBOne = nil
@@ -198,7 +198,7 @@ func (c *Client) Close() {
// Terminate tries to flush the entire redis and close clients
func (c *Client) Terminate() {
- c.Flush() // should go first
+ _ = c.Flush() // should go first
c.Close()
}
diff --git a/util/util.go b/util/util.go
index 55ccce3..7540003 100644
--- a/util/util.go
+++ b/util/util.go
@@ -50,7 +50,7 @@ func (w *Writer) SyncWriteJSONFile(obj interface{}) error {
if err != nil {
return err
}
- defer file.Close() // file is opened, must close
+ defer func() { _ = file.Close() }() // file is opened, must close
content, jsonErr := json.MarshalIndent(obj, "", "\t")
if jsonErr != nil {
diff --git a/watcher/handlerCache.go b/watcher/handlerCache.go
index 30acf58..221f16e 100644
--- a/watcher/handlerCache.go
+++ b/watcher/handlerCache.go
@@ -78,7 +78,7 @@ func (h *AtsCacheHandler) Add(obj interface{}) {
log.Printf("Add: Failed to open cache.config: %v", err)
return
}
- defer f.Close()
+ defer func() { _ = f.Close() }()
for _, line := range lines {
if _, err := f.WriteString(line + "\n"); err != nil {