Skip to content

Commit f4003b1

Browse files
author
Lucas Yoon
committed
Updating go version 1.24, fixing linting errors
Signed-off-by: Lucas Yoon <[email protected]>
1 parent d0fa9c1 commit f4003b1

File tree

8 files changed

+21
-24
lines changed

8 files changed

+21
-24
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ contribution. See the [DCO](./DCO) file for details.
1616
The following are required to work on devfile library:
1717

1818
- Git
19-
- Go 1.21 or later
19+
- Go 1.24 or later
2020

2121
## Code of Conduct
2222
Before contributing to this repository, see [contributor code of conduct](https://github.com/devfile/api/blob/main/CODE_OF_CONDUCT.md#contributor-covenant-code-of-conduct)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<div id="header">
44

5-
![Go](https://img.shields.io/badge/Go-1.21-blue)
5+
![Go](https://img.shields.io/badge/Go-1.24-blue)
66
[![Apache2.0 License](https://img.shields.io/badge/license-Apache2.0-brightgreen.svg)](LICENSE)
77
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8231/badge)](https://www.bestpractices.dev/projects/8231)
88
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/devfile/library/badge)](https://securityscorecards.dev/viewer/?uri=github.com/devfile/library)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/devfile/library/v2
22

3-
go 1.21
3+
go 1.24
44

55
require (
66
github.com/devfile/api/v2 v2.3.0

pkg/devfile/generator/generators_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func TestGetContainers(t *testing.T) {
358358
mockGetComponents.Return(tt.filteredComponents, nil).AnyTimes()
359359
}
360360
if tt.wantErr != nil {
361-
mockGetComponents.Return(nil, fmt.Errorf(*tt.wantErr))
361+
mockGetComponents.Return(nil, fmt.Errorf("%s", *tt.wantErr))
362362
}
363363
mockDevfileData.EXPECT().GetProjects(common.DevfileOptions{}).Return(projects, nil).AnyTimes()
364364

@@ -635,7 +635,7 @@ func TestGetVolumesAndVolumeMounts(t *testing.T) {
635635

636636
if tt.wantErr != nil {
637637
// simulate error condition
638-
mockGetContainerComponents.Return(nil, fmt.Errorf(*tt.wantErr))
638+
mockGetContainerComponents.Return(nil, fmt.Errorf("%s", *tt.wantErr))
639639

640640
}
641641

@@ -878,7 +878,7 @@ func TestGetInitContainers(t *testing.T) {
878878
mockGetCommands.Return(append(applyCommands, compCommands...), nil).AnyTimes()
879879

880880
if tt.wantErr != nil {
881-
mockGetCommands.Return(nil, fmt.Errorf(*tt.wantErr)).AnyTimes()
881+
mockGetCommands.Return(nil, fmt.Errorf("%s", *tt.wantErr)).AnyTimes()
882882
}
883883

884884
devObj := parser.DevfileObj{

pkg/devfile/parser/data/helper.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ func NewDevfileData(version string) (obj DevfileData, err error) {
3535
// Fetch devfile struct type from map
3636
devfileType, ok := apiVersionToDevfileStruct[supportedApiVersion(version)]
3737
if !ok {
38-
errMsg := fmt.Sprintf("devfile type not present for apiVersion '%s'", version)
39-
return obj, fmt.Errorf(errMsg)
38+
return obj, fmt.Errorf("devfile type not present for apiVersion '%s'", version)
4039
}
4140

4241
return reflect.New(devfileType).Interface().(DevfileData), nil

pkg/devfile/parser/utils.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,14 @@ func GetImageBuildComponent(devfileData data.DevfileData, deployAssociatedCompon
9696
if reflect.DeepEqual(imageBuildComponent, devfilev1.Component{}) {
9797
imageBuildComponent = component
9898
} else {
99-
errMsg := "expected to find one devfile image component with a deploy command for build. Currently there is more than one image component"
100-
return devfilev1.Component{}, fmt.Errorf(errMsg)
99+
return devfilev1.Component{}, fmt.Errorf("expected to find one devfile image component with a deploy command for build. Currently there is more than one image component")
101100
}
102101
}
103102
}
104103

105104
// If there is not one image component defined in the deploy command, err out
106105
if reflect.DeepEqual(imageBuildComponent, devfilev1.Component{}) {
107-
errMsg := "expected to find one devfile image component with a deploy command for build. Currently there is no image component"
108-
return devfilev1.Component{}, fmt.Errorf(errMsg)
106+
return devfilev1.Component{}, fmt.Errorf("expected to find one devfile image component with a deploy command for build. Currently there is no image component")
109107
}
110108

111109
return imageBuildComponent, nil

pkg/devfile/parser/utils_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func TestGetDeployComponents(t *testing.T) {
178178
mockDeployCommands := mockDevfileData.EXPECT().GetCommands(deployCommandFilter)
179179
mockDeployCommands.Return(tt.deployCommands, nil).AnyTimes()
180180
if tt.wantMockErr1 != nil {
181-
mockDeployCommands.Return(nil, fmt.Errorf(*tt.wantMockErr1))
181+
mockDeployCommands.Return(nil, fmt.Errorf("%s", *tt.wantMockErr1))
182182
}
183183

184184
applyCommandFilter := common.DevfileOptions{
@@ -189,7 +189,7 @@ func TestGetDeployComponents(t *testing.T) {
189189
mockApplyCommands := mockDevfileData.EXPECT().GetCommands(applyCommandFilter)
190190
mockApplyCommands.Return(tt.applyCommands, nil).AnyTimes()
191191
if tt.wantMockErr2 != nil {
192-
mockApplyCommands.Return(nil, fmt.Errorf(*tt.wantMockErr2))
192+
mockApplyCommands.Return(nil, fmt.Errorf("%s", *tt.wantMockErr2))
193193
}
194194

195195
componentMap, err := GetDeployComponents(mockDevfileData)
@@ -361,7 +361,7 @@ func TestGetImageBuildComponent(t *testing.T) {
361361
// set up the mock data
362362
mockGetComponents.Return(tt.components, nil).AnyTimes()
363363
if tt.wantMockErr != nil {
364-
mockGetComponents.Return(nil, fmt.Errorf(*tt.wantMockErr))
364+
mockGetComponents.Return(nil, fmt.Errorf("%s", *tt.wantMockErr))
365365
}
366366

367367
component, err := GetImageBuildComponent(mockDevfileData, tt.deployAssociatedComponents)

tests/v2/utils/library/test_utils.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func CopyDevfileSamples(t *testing.T, testDevfiles []string) {
297297

298298
file, err := os.Stat(srcPath)
299299
if err != nil {
300-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("Error locating testDevfile %v ", err)))
300+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("Error locating testDevfile %v ", err)))
301301
} else {
302302
commonUtils.LogMessage(fmt.Sprintf("copy file from %s to %s ", srcPath, destPath))
303303
util.CopyFile(srcPath, destPath, file)
@@ -312,7 +312,7 @@ func duplicateDevfileSample(t *testing.T, src string, dst string) {
312312
destPath := destDir + dst
313313
file, err := os.Stat(srcPath)
314314
if err != nil {
315-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("Error locating testDevfile %v ", err)))
315+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("Error locating testDevfile %v ", err)))
316316
} else {
317317
commonUtils.LogMessage(fmt.Sprintf("duplicate file %s to %s ", srcPath, destPath))
318318
util.CopyFile(srcPath, destDir+dst, file)
@@ -332,15 +332,15 @@ func RunTest(testContent commonUtils.TestContent, t *testing.T) {
332332
follower := DevfileFollower{}
333333
libraryData, err := devfileData.NewDevfileData(schemaVersion)
334334
if err != nil {
335-
t.Fatalf(commonUtils.LogMessage(fmt.Sprintf("Error creating parser data : %v", err)))
335+
t.Fatalf("%s", commonUtils.LogMessage(fmt.Sprintf("Error creating parser data : %v", err)))
336336
}
337337
libraryData.SetSchemaVersion(schemaVersion)
338338
follower.LibraryData = libraryData
339339
commonUtils.LogMessage(fmt.Sprintf("Parser data created with schema version : %s", follower.LibraryData.GetSchemaVersion()))
340340

341341
testDevfile, err := commonUtils.GetDevfile(testContent.FileName, follower, validator)
342342
if err != nil {
343-
t.Fatalf(commonUtils.LogMessage(fmt.Sprintf("Error creating devfile : %v", err)))
343+
t.Fatalf("%s", commonUtils.LogMessage(fmt.Sprintf("Error creating devfile : %v", err)))
344344
}
345345

346346
testDevfile.RunTest(testContent, t)
@@ -349,25 +349,25 @@ func RunTest(testContent commonUtils.TestContent, t *testing.T) {
349349
if len(testContent.CommandTypes) > 0 {
350350
err = editCommands(&testDevfile)
351351
if err != nil {
352-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing commands : %s : %v", testContent.FileName, err)))
352+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing commands : %s : %v", testContent.FileName, err)))
353353
}
354354
}
355355
if len(testContent.ComponentTypes) > 0 {
356356
err = editComponents(&testDevfile)
357357
if err != nil {
358-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing components : %s : %v", testContent.FileName, err)))
358+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing components : %s : %v", testContent.FileName, err)))
359359
}
360360
}
361361
if len(testContent.ProjectTypes) > 0 {
362362
err = editProjects(&testDevfile)
363363
if err != nil {
364-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing projects : %s : %v", testContent.FileName, err)))
364+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing projects : %s : %v", testContent.FileName, err)))
365365
}
366366
}
367367
if len(testContent.StarterProjectTypes) > 0 {
368368
err = editStarterProjects(&testDevfile)
369369
if err != nil {
370-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing starter projects : %s : %v", testContent.FileName, err)))
370+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("ERROR editing starter projects : %s : %v", testContent.FileName, err)))
371371
}
372372
}
373373

@@ -386,7 +386,7 @@ func RunStaticTest(testContent commonUtils.TestContent, t *testing.T) {
386386
testDevfile.SchemaDevFile.Parent = &schema.Parent{}
387387
err := validateDevfile(&testDevfile)
388388
if err != nil {
389-
t.Fatalf(commonUtils.LogErrorMessage(fmt.Sprintf("Error validating testDevfile %v ", err)))
389+
t.Fatalf("%s", commonUtils.LogErrorMessage(fmt.Sprintf("Error validating testDevfile %v ", err)))
390390
}
391391
}
392392

0 commit comments

Comments
 (0)