Skip to content

Commit 4cb876a

Browse files
chore: update go to 1.24.4 (#299)
1 parent 0478a80 commit 4cb876a

File tree

13 files changed

+31
-26
lines changed

13 files changed

+31
-26
lines changed

.2ms.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,9 @@ ignore-result:
105105
- af16d5223104c029475f82cd780fd57115ed1e2f # value used for testing
106106
- 91bc1fc92b04c56c5f746d50df5759e39b956146 # value used for testing
107107
- 4d4af54fd6e3e1209094e5838f339b6c95636f79 # value used for testing
108-
- fabcbd067a3bbf3cd5951d03ed4f17918241316a # value used for testing
108+
- fabcbd067a3bbf3cd5951d03ed4f17918241316a # value used for testing
109+
- cd186f025418cb008f61dcf881b62926be892f71 # value used for testing
110+
- 3a2c9e23253b0e5b8a83deaea772d93396e4f350 # value used for testing
111+
- 754506f714ffc10628e6fe6dd05affa486d78234 # value used for testing
112+
- eebd28cd68ee73b9a1f68b85453575498c12c5b8 # value used for testing
113+
- 14f5cf9d2716f2cec7daf95ab86e1a4feaf7ba41 # value used for testing

.github/workflows/pr-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
git diff --exit-code
3131
3232
- name: Go Linter
33-
run: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.61.0 golangci-lint run -v -E gofmt --timeout=5m --out-format github-actions
33+
run: docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v2.1.5 golangci-lint run --timeout=5m
3434

3535
- name: Go Test
3636
run: go test -v ./...

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# and "Missing User Instruction" since 2ms container is stopped after scan
44

55
# Builder image
6-
FROM cgr.dev/chainguard/go@sha256:7f9e74e1af376a6d238077d8df037a25001997581630bc121c8aecfa5c8da8b3 AS builder
6+
FROM checkmarx/go:1.24.4-r0-ae7309142bb6bd@sha256:ae7309142bb6bd82e0272c3624ec53c0c68d855f6b63e985c5caaff5c1705644 AS builder
77

88
WORKDIR /app
99

@@ -17,10 +17,10 @@ RUN go mod download
1717
# COPY the source code as the last step
1818
COPY . .
1919

20-
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -a -o /app/2ms .
20+
RUN GOOS=linux GOARCH=amd64 go build -buildvcs=false -ldflags="-s -w" -a -o /app/2ms .
2121

2222
# Runtime image
23-
FROM cgr.dev/chainguard/git@sha256:fb9f28194b4dda3ea74c68d731238d1f32023849bca04c5652638e8e199fb956
23+
FROM checkmarx/git:2.49.0-r2-d7ebbe7c56dc47@sha256:d7ebbe7c56dc478c08aba611c35b30689090d28605d83130ce4d1e15a84f0389
2424

2525
WORKDIR /app
2626

engine/engine.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ func GetRulesCommand(engineConfig *EngineConfig) *cobra.Command {
290290

291291
tab := tabwriter.NewWriter(os.Stdout, 1, 2, 2, ' ', 0)
292292

293-
fmt.Fprintln(tab, "Name\tDescription\tTags\tValidity Check")
294-
fmt.Fprintln(tab, "----\t----\t----\t----")
293+
fmt.Fprintln(tab, "Name\tDescription\tTags\tValidity Check") //nolint:errcheck
294+
fmt.Fprintln(tab, "----\t----\t----\t----") //nolint:errcheck
295295
for _, rule := range *rules {
296-
fmt.Fprintf(
296+
fmt.Fprintf( //nolint:errcheck
297297
tab,
298298
"%s\t%s\t%s\t%s\n",
299299
rule.Rule.RuleID,
@@ -352,7 +352,8 @@ func getStartAndEndLines(ctx context.Context, pluginName string, gitInfo *plugin
352352
var startLine, endLine int
353353
var err error
354354

355-
if pluginName == "filesystem" {
355+
switch pluginName {
356+
case "filesystem":
356357
totalLines, totalOK := ctx.Value(totalLinesKey).(int)
357358
chunkLines, chunkOK := ctx.Value(linesInChunkKey).(int)
358359

@@ -363,12 +364,12 @@ func getStartAndEndLines(ctx context.Context, pluginName string, gitInfo *plugin
363364

364365
startLine = value.StartLine + offset
365366
endLine = value.EndLine + offset
366-
} else if pluginName == "git" {
367+
case "git":
367368
startLine, endLine, err = plugins.GetGitStartAndEndLine(gitInfo, value.StartLine, value.EndLine)
368369
if err != nil {
369370
return 0, 0, err
370371
}
371-
} else {
372+
default:
372373
startLine = value.StartLine
373374
endLine = value.EndLine
374375
}

engine/engine_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ func writeTempFile(t *testing.T, dir string, size int, content []byte) string {
470470

471471
f, err := os.CreateTemp(dir, "testfile-*.tmp")
472472
require.NoError(t, err, "create temp file")
473-
defer f.Close()
473+
defer f.Close() //nolint:errcheck
474474

475475
var data []byte
476476
if content != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/checkmarx/2ms/v3
22

3-
go 1.23.6
3+
go 1.24.4
44

55
require (
66
github.com/bwmarrin/discordgo v0.27.1

lib/reporting/report_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ func TestWriteReportInNonExistingDir(t *testing.T) {
221221
if err != nil {
222222
t.Error(err)
223223
}
224-
225-
os.RemoveAll(filepath.Join(tempDir, "test_temp_dir"))
226224
}
227225

228226
func TestGetOutputSarif(t *testing.T) {

lib/utils/flags_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ subcommand:
685685
var configFileName string
686686
if tc.config != nil {
687687
configFileName = writeTempFile(t, tc.config, tc.configFormat)
688-
defer os.Remove(configFileName)
688+
defer os.Remove(configFileName) //nolint:errcheck
689689

690690
tc.args = append(tc.args, "--"+configFlagName, configFileName)
691691
}

lib/utils/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func HttpRequest(method string, url string, authorization IAuthorizationHeader,
4343
return nil, response, fmt.Errorf("unable to send http request %w", err)
4444
}
4545

46-
defer response.Body.Close()
46+
defer response.Body.Close() //nolint:errcheck
4747

4848
if response.StatusCode < 200 || response.StatusCode >= 300 {
4949
if retry.MaxRetries > 0 {

plugins/git.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (p *GitPlugin) DefineCommand(items chan ISourceItem, errors chan error) (*c
5858
Args: cobra.MatchAll(cobra.ExactArgs(1), validGitRepoArgs),
5959
Run: func(cmd *cobra.Command, args []string) {
6060
log.Info().Msg("Git plugin started")
61-
p.scanGit(args[0], p.buildScanOptions(), p.Channels.Items, p.Channels.Errors)
61+
p.scanGit(args[0], p.buildScanOptions(), p.Items, p.Errors)
6262
p.WaitGroup.Wait()
6363
close(items)
6464
},

0 commit comments

Comments
 (0)