Skip to content

Commit 0c144c2

Browse files
update golang to 1.24.3 [v8] (#3509)
* update golang to 1.24.3 * up golangci-lint version --------- Co-authored-by: Shwetha Gururaj <[email protected]>
1 parent d16370f commit 0c144c2

File tree

25 files changed

+85
-85
lines changed

25 files changed

+85
-85
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: golangci-lint
3737
uses: golangci/golangci-lint-action@v6
3838
with:
39-
version: v1.61
39+
version: v1.64
4040
args: -v --exclude-dirs cf --exclude-dirs fixtures --exclude-dirs plugin --exclude-dirs command/plugin
4141
format:
4242
name: Run go fmt

cf/actors/push.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"path/filepath"
88
"runtime"
99

10+
"errors"
11+
1012
"code.cloudfoundry.org/cli/cf/api/applicationbits"
1113
"code.cloudfoundry.org/cli/cf/api/resources"
1214
"code.cloudfoundry.org/cli/cf/appfiles"
@@ -186,29 +188,29 @@ func (actor PushActorImpl) ValidateAppParams(apps []models.AppParams) []error {
186188
appName := app.Name
187189

188190
if app.HealthCheckType != nil && *app.HealthCheckType != "http" && app.HealthCheckHTTPEndpoint != nil {
189-
errs = append(errs, fmt.Errorf(T("Health check type must be 'http' to set a health check HTTP endpoint.")))
191+
errs = append(errs, errors.New(T("Health check type must be 'http' to set a health check HTTP endpoint.")))
190192
}
191193

192194
if app.Routes != nil {
193195
if app.Hosts != nil {
194-
errs = append(errs, fmt.Errorf(T("Application {{.AppName}} must not be configured with both 'routes' and 'host'/'hosts'", map[string]interface{}{"AppName": appName})))
196+
errs = append(errs, errors.New(T("Application {{.AppName}} must not be configured with both 'routes' and 'host'/'hosts'", map[string]interface{}{"AppName": appName})))
195197
}
196198

197199
if app.Domains != nil {
198-
errs = append(errs, fmt.Errorf(T("Application {{.AppName}} must not be configured with both 'routes' and 'domain'/'domains'", map[string]interface{}{"AppName": appName})))
200+
errs = append(errs, errors.New(T("Application {{.AppName}} must not be configured with both 'routes' and 'domain'/'domains'", map[string]interface{}{"AppName": appName})))
199201
}
200202

201203
if app.NoHostname != nil {
202-
errs = append(errs, fmt.Errorf(T("Application {{.AppName}} must not be configured with both 'routes' and 'no-hostname'", map[string]interface{}{"AppName": appName})))
204+
errs = append(errs, errors.New(T("Application {{.AppName}} must not be configured with both 'routes' and 'no-hostname'", map[string]interface{}{"AppName": appName})))
203205
}
204206
}
205207

206208
if app.BuildpackURL != nil && app.DockerImage != nil {
207-
errs = append(errs, fmt.Errorf(T("Application {{.AppName}} must not be configured with both 'buildpack' and 'docker'", map[string]interface{}{"AppName": appName})))
209+
errs = append(errs, errors.New(T("Application {{.AppName}} must not be configured with both 'buildpack' and 'docker'", map[string]interface{}{"AppName": appName})))
208210
}
209211

210212
if app.Path != nil && app.DockerImage != nil {
211-
errs = append(errs, fmt.Errorf(T("Application {{.AppName}} must not be configured with both 'docker' and 'path'", map[string]interface{}{"AppName": appName})))
213+
errs = append(errs, errors.New(T("Application {{.AppName}} must not be configured with both 'docker' and 'path'", map[string]interface{}{"AppName": appName})))
212214
}
213215
}
214216

cf/actors/routes.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,15 @@ func (routeActor routeActor) FindAndBindRoute(routeName string, app models.Appli
233233

234234
func validateRoute(routeName string, domainType string, port int, path string) error {
235235
if domainType == tcp && path != "" {
236-
return fmt.Errorf(T("Path not allowed in TCP route {{.RouteName}}",
236+
return errors.New(T("Path not allowed in TCP route {{.RouteName}}",
237237
map[string]interface{}{
238238
"RouteName": routeName,
239239
},
240240
))
241241
}
242242

243243
if domainType == "" && port != 0 {
244-
return fmt.Errorf(T("Port not allowed in HTTP route {{.RouteName}}",
244+
return errors.New(T("Port not allowed in HTTP route {{.RouteName}}",
245245
map[string]interface{}{
246246
"RouteName": routeName,
247247
},
@@ -288,7 +288,7 @@ func parseRoute(routeName string, findFunc func(domainName string) (models.Domai
288288
return routeParts[0], domain, false, nil
289289
}
290290

291-
return "", models.DomainFields{}, true, fmt.Errorf(T(
291+
return "", models.DomainFields{}, true, errors.New(T(
292292
"The route {{.RouteName}} did not match any existing domains.",
293293
map[string]interface{}{
294294
"RouteName": routeName,

cf/api/resources/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ func (resource EventResourceOldV2) ToFields() models.EventFields {
5757
GUID: resource.Metadata.GUID,
5858
Name: T("app crashed"),
5959
Timestamp: resource.Entity.Timestamp,
60-
Description: fmt.Sprintf(T("instance: {{.InstanceIndex}}, reason: {{.ExitDescription}}, exit_status: {{.ExitStatus}}",
60+
Description: T("instance: {{.InstanceIndex}}, reason: {{.ExitDescription}}, exit_status: {{.ExitStatus}}",
6161
map[string]interface{}{
6262
"InstanceIndex": resource.Entity.InstanceIndex,
6363
"ExitDescription": resource.Entity.ExitDescription,
6464
"ExitStatus": strconv.Itoa(resource.Entity.ExitStatus),
65-
})),
65+
}),
6666
}
6767
}
6868

cf/api/stacks/stacks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (repo CloudControllerStackRepository) FindByGUID(guid string) (models.Stack
4141
return models.Stack{}, errNotFound
4242
}
4343

44-
return models.Stack{}, fmt.Errorf(T("Error retrieving stacks: {{.Error}}", map[string]interface{}{
44+
return models.Stack{}, errors.New(T("Error retrieving stacks: {{.Error}}", map[string]interface{}{
4545
"Error": err.Error(),
4646
}))
4747
}

cf/api/users.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func userGUIDPath(apiEndpoint, userGUID, orgGUID string, role models.Role) (stri
290290
func (repo CloudControllerUserRepository) SetSpaceRoleByGUID(userGUID, spaceGUID, orgGUID string, role models.Role) error {
291291
rolePath, found := spaceRoleToPathMap[role]
292292
if !found {
293-
return fmt.Errorf(T("Invalid Role {{.Role}}", map[string]interface{}{"Role": role}))
293+
return errors.New(T("Invalid Role {{.Role}}", map[string]interface{}{"Role": role}))
294294
}
295295

296296
err := repo.assocUserWithOrgByUserGUID(userGUID, orgGUID)
@@ -330,7 +330,7 @@ func (repo CloudControllerUserRepository) SetSpaceRoleByUsername(username, space
330330
func (repo CloudControllerUserRepository) UnsetSpaceRoleByGUID(userGUID, spaceGUID string, role models.Role) error {
331331
rolePath, found := spaceRoleToPathMap[role]
332332
if !found {
333-
return fmt.Errorf(T("Invalid Role {{.Role}}", map[string]interface{}{"Role": role}))
333+
return errors.New(T("Invalid Role {{.Role}}", map[string]interface{}{"Role": role}))
334334
}
335335
apiURL := fmt.Sprintf("/v2/spaces/%s/%s/%s", spaceGUID, rolePath, userGUID)
336336

@@ -343,7 +343,7 @@ func (repo CloudControllerUserRepository) checkSpaceRole(spaceGUID string, role
343343
rolePath, found := spaceRoleToPathMap[role]
344344

345345
if !found {
346-
apiErr = fmt.Errorf(T("Invalid Role {{.Role}}",
346+
apiErr = errors.New(T("Invalid Role {{.Role}}",
347347
map[string]interface{}{"Role": role}))
348348
}
349349

@@ -373,7 +373,7 @@ func rolePath(role models.Role) (string, error) {
373373
path, found := orgRoleToPathMap[role]
374374

375375
if !found {
376-
return "", fmt.Errorf(T("Invalid Role {{.Role}}",
376+
return "", errors.New(T("Invalid Role {{.Role}}",
377377
map[string]interface{}{"Role": role}))
378378
}
379379
return path, nil

cf/commandregistry/registry.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ func initI18nFunc() bool {
3535
T = Init(config)
3636

3737
if err != nil {
38-
fmt.Fprintf(os.Stderr, fmt.Sprintf("%s\n", T(configErrTemplate, map[string]interface{}{
38+
msg := T(configErrTemplate, map[string]interface{}{
3939
"FilePath": configv3.ConfigFilePath(),
40-
})))
40+
})
41+
fmt.Fprintf(os.Stderr, "%s\n", msg)
4142
}
4243
return true
4344
}

cf/commands/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func (cmd API) Execute(c flags.FlagContext) error {
6161

6262
} else if len(c.Args()) == 0 {
6363
if cmd.config.APIEndpoint() == "" {
64-
cmd.ui.Say(fmt.Sprintf(T("No api endpoint set. Use '{{.Name}}' to set an endpoint",
65-
map[string]interface{}{"Name": terminal.CommandColor(cf.Name + " api")})))
64+
cmd.ui.Say(T("No api endpoint set. Use '{{.Name}}' to set an endpoint",
65+
map[string]interface{}{"Name": terminal.CommandColor(cf.Name + " api")}))
6666
} else {
6767
cmd.ui.Say(T("API endpoint: {{.APIEndpoint}} (API version: {{.APIVersion}})",
6868
map[string]interface{}{"APIEndpoint": terminal.EntityNameColor(cmd.config.APIEndpoint()),
@@ -106,8 +106,8 @@ func (cmd API) setAPIEndpoint(endpoint string, skipSSL bool, cmdName string) err
106106
switch typedErr := err.(type) {
107107
case *errors.InvalidSSLCert:
108108
cfAPICommand := terminal.CommandColor(fmt.Sprintf("%s %s --skip-ssl-validation", cf.Name, cmdName))
109-
tipMessage := fmt.Sprintf(T("TIP: Use '{{.APICommand}}' to continue with an insecure API endpoint",
110-
map[string]interface{}{"APICommand": cfAPICommand}))
109+
tipMessage := T("TIP: Use '{{.APICommand}}' to continue with an insecure API endpoint",
110+
map[string]interface{}{"APICommand": cfAPICommand})
111111
return errors.New(T("Invalid SSL Cert for {{.URL}}\n{{.TipMessage}}",
112112
map[string]interface{}{"URL": typedErr.URL, "TipMessage": tipMessage}))
113113
default:

cf/commands/application/app.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ func (cmd *ShowApp) ShowApp(app models.Application, orgName, spaceName string) e
183183
uihelpers.ColoredInstanceState(instance),
184184
instance.Since.Format("2006-01-02 03:04:05 PM"),
185185
fmt.Sprintf("%.1f%%", instance.CPUUsage*100),
186-
fmt.Sprintf(T("{{.MemUsage}} of {{.MemQuota}}",
186+
T("{{.MemUsage}} of {{.MemQuota}}",
187187
map[string]interface{}{
188188
"MemUsage": formatters.ByteSize(instance.MemUsage),
189-
"MemQuota": formatters.ByteSize(instance.MemQuota)})),
190-
fmt.Sprintf(T("{{.DiskUsage}} of {{.DiskQuota}}",
189+
"MemQuota": formatters.ByteSize(instance.MemQuota)}),
190+
T("{{.DiskUsage}} of {{.DiskQuota}}",
191191
map[string]interface{}{
192192
"DiskUsage": formatters.ByteSize(instance.DiskUsage),
193-
"DiskQuota": formatters.ByteSize(instance.DiskQuota)})),
194-
fmt.Sprintf("%s", instance.Details),
193+
"DiskQuota": formatters.ByteSize(instance.DiskQuota)}),
194+
instance.Details,
195195
)
196196
}
197197

cf/commands/application/copy_source.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package application
22

33
import (
44
"errors"
5-
"fmt"
65
"strings"
76

87
"code.cloudfoundry.org/cli/cf/api/applications"
@@ -171,7 +170,7 @@ func (cmd *CopySource) findSpaceFields(targetOrg, targetSpace string) (models.Sp
171170
}
172171

173172
if !foundSpace {
174-
return models.SpaceFields{}, fmt.Errorf(T("Could not find space {{.Space}} in organization {{.Org}}",
173+
return models.SpaceFields{}, errors.New(T("Could not find space {{.Space}} in organization {{.Org}}",
175174
map[string]interface{}{
176175
"Space": terminal.EntityNameColor(targetSpace),
177176
"Org": terminal.EntityNameColor(targetOrg),
@@ -183,14 +182,14 @@ func (cmd *CopySource) findSpaceFields(targetOrg, targetSpace string) (models.Sp
183182
}
184183

185184
func buildCopyString(sourceAppName, targetAppName, targetOrgName, targetSpaceName, username string) string {
186-
return fmt.Sprintf(T("Copying source from app {{.SourceApp}} to target app {{.TargetApp}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...",
185+
return T("Copying source from app {{.SourceApp}} to target app {{.TargetApp}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...",
187186
map[string]interface{}{
188187
"SourceApp": terminal.EntityNameColor(sourceAppName),
189188
"TargetApp": terminal.EntityNameColor(targetAppName),
190189
"OrgName": terminal.EntityNameColor(targetOrgName),
191190
"SpaceName": terminal.EntityNameColor(targetSpaceName),
192191
"Username": terminal.EntityNameColor(username),
193192
},
194-
))
193+
)
195194

196195
}

0 commit comments

Comments
 (0)