Skip to content

Commit ef0b081

Browse files
authored
Upgrade to Go 1.26 and restore repository build compatibility
* Upgrade to Go 1.26 and restore repository build compatibility Upgrade the module/toolchain baseline to Go 1.26 and fix follow-on compile/vet regressions so the repo builds cleanly. - update Go version baseline in `go.mod` (and corresponding `go.sum` updates) - migrate CLI table rendering to tablewriter v1 API (`Header`/`Footer`) - replace removed tablewriter markdown setters in `cli/cmd/images.go` with explicit markdown table output - fix Go 1.26 vet/compile logger issues in touched files: - remove dynamic format-string misuse in `*f` logging calls - replace `%w` in logger format strings - fix printf/non-printf logger method mismatches - standardize touched-file error logs on `WithError(err)` style
1 parent 6aa2147 commit ef0b081

150 files changed

Lines changed: 2383 additions & 3266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/github-actions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: checks
22
env:
3-
GO_VERSION: '1.25'
3+
GO_VERSION: '1.26'
44
on:
55
pull_request:
66
branches:
@@ -43,7 +43,7 @@ jobs:
4343
- name: golangci-lint
4444
# Switch back to the official action after this bug is fixed: https://github.com/golangci/golangci-lint/issues/3107
4545
run: |
46-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.6.0
46+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.11.4
4747
$(go env GOPATH)/bin/golangci-lint run --output.text.path=github-actions --timeout=15m --verbose
4848
go-mod-tidy:
4949
name: go mod tidy

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: "2"
22
run:
3-
go: "1.25"
3+
go: "1.26"
44
linters:
55
default: none
66
enable:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ REGISTRY ?= $(DEFAULT_REGISTRY)
1414
BUILDX_OUTPUT ?= load
1515

1616
# GO_IMAGE golang image used in default GO_SHELL
17-
GO_IMAGE ?= golang:1.25
17+
GO_IMAGE ?= golang:1.26
1818

1919
# GO_CMD go command used for go build
2020
GO_CMD ?= go

acp/rest/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (c *Client) newRequest(ctx context.Context, method, url string, data []byte
125125
// It returns the http response, the response body or an error if one occurs.
126126
func (c *Client) invokeAPI(req *http.Request) (*http.Response, []byte, error) {
127127
// Make the request.
128-
res, err := c.httpClient.Do(req)
128+
res, err := c.httpClient.Do(req) //nolint:gosec // request URL is built by this ACP client, not user taint
129129
if err != nil {
130130
return nil, nil, fmt.Errorf("failed to invoke Trident-ACP REST API: [%s]; %v", req.URL.String(), err)
131131
}

cli/cmd/check_operator.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,40 +127,40 @@ func writeStatus(status cliapi.OperatorStatus) {
127127

128128
func writeStatusTable(status cliapi.OperatorStatus) {
129129
table := tablewriter.NewWriter(os.Stdout)
130-
table.SetHeader([]string{"Name", "Type", "Status"})
130+
table.Header([]string{"Name", "Type", "Status"})
131131
if status.ErrorMessage != "" {
132-
table.SetFooter([]string{"Overall Status", status.Status, status.ErrorMessage})
132+
table.Footer([]string{"Overall Status", status.Status, status.ErrorMessage})
133133
} else {
134-
table.SetFooter([]string{"Overall Status", status.Status, ""})
134+
table.Footer([]string{"Overall Status", status.Status, ""})
135135
}
136136

137137
for torcName, torcStatus := range status.TorcStatus {
138-
table.Append([]string{torcName, "TridentOrchestratorCR", torcStatus.Status})
138+
_ = table.Append([]string{torcName, "TridentOrchestratorCR", torcStatus.Status})
139139
}
140140

141141
for tconfName, tconfStatus := range status.TconfStatus {
142-
table.Append([]string{tconfName, "TridentConfiguratorCR", tconfStatus.Status})
142+
_ = table.Append([]string{tconfName, "TridentConfiguratorCR", tconfStatus.Status})
143143
}
144144

145-
table.Render()
145+
_ = table.Render()
146146
}
147147

148148
func writeStatusTableWide(status cliapi.OperatorStatus) {
149149
table := tablewriter.NewWriter(os.Stdout)
150-
table.SetHeader([]string{"Name", "Type", "Status", "Message"})
150+
table.Header([]string{"Name", "Type", "Status", "Message"})
151151
if status.ErrorMessage != "" {
152-
table.SetFooter([]string{"Overall Status", status.Status, status.ErrorMessage, ""})
152+
table.Footer([]string{"Overall Status", status.Status, status.ErrorMessage, ""})
153153
} else {
154-
table.SetFooter([]string{"Overall Status", status.Status, "", ""})
154+
table.Footer([]string{"Overall Status", status.Status, "", ""})
155155
}
156156

157157
for torcName, torcStatus := range status.TorcStatus {
158-
table.Append([]string{torcName, "TridentOrchestratorCR", torcStatus.Status, torcStatus.Message})
158+
_ = table.Append([]string{torcName, "TridentOrchestratorCR", torcStatus.Status, torcStatus.Message})
159159
}
160160

161161
for tconfName, tconfStatus := range status.TconfStatus {
162-
table.Append([]string{tconfName, "TridentConfiguratorCR", tconfStatus.Status, tconfStatus.Message})
162+
_ = table.Append([]string{tconfName, "TridentConfiguratorCR", tconfStatus.Status, tconfStatus.Message})
163163
}
164164

165-
table.Render()
165+
_ = table.Render()
166166
}

cli/cmd/check_operator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func TestWriteStatus(t *testing.T) {
132132
"tconf1": {Status: "Done", Message: "Done"},
133133
},
134134
},
135-
contains: []string{"DONE", "Done", "torc1", "tconf1"},
135+
contains: []string{"Done", "torc1", "tconf1"},
136136
},
137137
{
138138
name: "WideFormatError",
@@ -141,7 +141,7 @@ func TestWriteStatus(t *testing.T) {
141141
Status: "Failed",
142142
ErrorMessage: "Error",
143143
},
144-
contains: []string{"FAILED", "ERROR"},
144+
contains: []string{"Failed", "Error"},
145145
},
146146
{
147147
name: "DefaultFormat",
@@ -155,7 +155,7 @@ func TestWriteStatus(t *testing.T) {
155155
"tconf1": {Status: "Done"},
156156
},
157157
},
158-
contains: []string{"DONE", "Done", "torc1", "tconf1"},
158+
contains: []string{"Done", "torc1", "tconf1"},
159159
},
160160
{
161161
name: "DefaultFormatError",
@@ -164,7 +164,7 @@ func TestWriteStatus(t *testing.T) {
164164
Status: "Failed",
165165
ErrorMessage: "Error",
166166
},
167-
contains: []string{"FAILED", "ERROR"},
167+
contains: []string{"Failed", "Error"},
168168
},
169169
}
170170

cli/cmd/get_autogrowpolicy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func writeAutogrowPolicyTable(autogrowPolicies []storage.AutogrowPolicyExternal)
138138
})
139139

140140
table := tablewriter.NewWriter(os.Stdout)
141-
table.SetHeader([]string{"Name", "Used Threshold", "Growth Amount", "Max Size", "Volumes"})
141+
table.Header([]string{"Name", "Used Threshold", "Growth Amount", "Max Size", "Volumes"})
142142

143143
for _, agp := range autogrowPolicies {
144144
maxSize := agp.MaxSize
@@ -151,7 +151,7 @@ func writeAutogrowPolicyTable(autogrowPolicies []storage.AutogrowPolicyExternal)
151151
growthAmount = config.DefaultAGPGrowthAmount // Default value
152152
}
153153

154-
table.Append([]string{
154+
_ = table.Append([]string{
155155
agp.Name,
156156
agp.UsedThreshold,
157157
growthAmount,
@@ -160,7 +160,7 @@ func writeAutogrowPolicyTable(autogrowPolicies []storage.AutogrowPolicyExternal)
160160
})
161161
}
162162

163-
table.Render()
163+
_ = table.Render()
164164
}
165165

166166
func writeAutogrowPolicyNames(autogrowPolicies []storage.AutogrowPolicyExternal) {

cli/cmd/get_backend.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func getSolidfireStorageDriverConfig(configAsMap map[string]interface{}) (*drive
197197

198198
func writeBackendTable(backends []storage.BackendExternal) {
199199
table := tablewriter.NewWriter(os.Stdout)
200-
table.SetHeader([]string{"Name", "Storage Driver", "UUID", "State", "User-State", "Volumes"})
200+
table.Header([]string{"Name", "Storage Driver", "UUID", "State", "User-State", "Volumes"})
201201

202202
for _, b := range backends {
203203
if b.Config == nil {
@@ -206,7 +206,7 @@ func writeBackendTable(backends []storage.BackendExternal) {
206206

207207
if configAsMap, ok := b.Config.(map[string]interface{}); ok {
208208
storageDriverName := configAsMap["storageDriverName"].(string)
209-
table.Append([]string{
209+
_ = table.Append([]string{
210210
b.Name,
211211
storageDriverName,
212212
b.BackendUUID,
@@ -217,7 +217,7 @@ func writeBackendTable(backends []storage.BackendExternal) {
217217
}
218218
}
219219

220-
table.Render()
220+
_ = table.Render()
221221
}
222222

223223
func writeBackendNames(backends []storage.BackendExternal) {

cli/cmd/get_groupsnapshot.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ func writeGroupSnapshotIDs(groups []storage.GroupSnapshotExternal) {
165165

166166
func writeGroupSnapshotTable(groupSnapshots []storage.GroupSnapshotExternal) {
167167
table := tablewriter.NewWriter(os.Stdout)
168-
table.SetHeader([]string{"Name"})
168+
table.Header([]string{"Name"})
169169

170170
for _, group := range groupSnapshots {
171-
table.Append([]string{
171+
_ = table.Append([]string{
172172
group.ID(),
173173
})
174174
}
175175

176-
table.Render()
176+
_ = table.Render()
177177
}
178178

179179
func formatIDs(ids []string, max int) string {
@@ -194,21 +194,21 @@ func formatIDs(ids []string, max int) string {
194194

195195
func writeWideGroupSnapshotTable(groupSnapshots []storage.GroupSnapshotExternal) {
196196
table := tablewriter.NewWriter(os.Stdout)
197-
table.SetHeader([]string{
197+
table.Header([]string{
198198
"Name",
199199
"Created",
200200
"Snapshots",
201201
"Snapshot Count",
202202
})
203203

204204
for _, group := range groupSnapshots {
205-
table.Append([]string{
205+
_ = table.Append([]string{
206206
group.ID(),
207207
group.GetCreated(),
208208
formatIDs(group.GetSnapshotIDs(), maxSnapshotRows),
209209
fmt.Sprintf("%d", len(group.GetSnapshotIDs())),
210210
})
211211
}
212212

213-
table.Render()
213+
_ = table.Render()
214214
}

cli/cmd/get_node.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ func WriteNodes(nodes []models.NodeExternal) {
135135

136136
func writeNodeTable(nodes []models.NodeExternal) {
137137
table := tablewriter.NewWriter(os.Stdout)
138-
table.SetHeader([]string{"Name"})
138+
table.Header([]string{"Name"})
139139

140140
for _, n := range nodes {
141-
table.Append([]string{
141+
_ = table.Append([]string{
142142
n.Name,
143143
})
144144
}
145145

146-
table.Render()
146+
_ = table.Render()
147147
}
148148

149149
func writeWideNodeTable(nodes []models.NodeExternal) {
@@ -156,14 +156,14 @@ func writeWideNodeTable(nodes []models.NodeExternal) {
156156
"Services",
157157
"State",
158158
}
159-
table.SetHeader(header)
159+
table.Header(header)
160160

161161
for _, node := range nodes {
162162
var services []string
163163
if node.HostInfo != nil {
164164
services = node.HostInfo.Services
165165
}
166-
table.Append([]string{
166+
_ = table.Append([]string{
167167
node.Name,
168168
node.IQN,
169169
strings.Join(node.IPs, "\n"),
@@ -172,7 +172,7 @@ func writeWideNodeTable(nodes []models.NodeExternal) {
172172
})
173173
}
174174

175-
table.Render()
175+
_ = table.Render()
176176
}
177177

178178
func writeNodeNames(nodes []models.NodeExternal) {

0 commit comments

Comments
 (0)