Skip to content

Commit 8763f70

Browse files
committed
fix CI checks
1 parent dafd47b commit 8763f70

File tree

11 files changed

+36
-19
lines changed

11 files changed

+36
-19
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Go
2121
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
2222
with:
23-
go-version: '1.24'
23+
go-version: '1.26'
2424
cache: true
2525
cache-dependency-path: go.sum
2626

@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Go
4444
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
4545
with:
46-
go-version: '1.24'
46+
go-version: '1.26'
4747
cache: true
4848
cache-dependency-path: go.sum
4949

@@ -63,7 +63,7 @@ jobs:
6363
- name: Set up Go
6464
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
6565
with:
66-
go-version: '1.24'
66+
go-version: '1.26'
6767
cache: true
6868
cache-dependency-path: go.sum
6969

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.exe
2+
*.exe~
3+
*.dll
4+
*.so
5+
*.dylib
6+
kmir
7+
*.test
8+
*.out
9+
coverage.*
10+
coverage.html
11+

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
2+
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ test-short: ## Run short tests only
2626

2727
lint: ## Run linters
2828
@echo "Running linters..."
29-
$(LINTER) run --timeout 5m ./...; \
29+
$(LINTER) run --timeout 5m ./...
3030

3131
fix: ## Auto-fix linting issues
3232
@echo "Fixing linting issues..."
33-
$(LINTER) run --fix --timeout 5m ./...; \
33+
$(LINTER) run --fix --timeout 5m ./...
3434

3535
coverage: ## Generate coverage report
3636
@echo "Generating coverage report..."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ kmir --source-brokers=localhost:9092 --sink-brokers=localhost:9093 --client-id=m
7373

7474
### Prerequisites
7575

76-
- Go 1.24 or later
76+
- Go 1.26 or later
7777
- golangci-lint v2.11.4 or later
7878

7979
### Setup

config.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main provides functionality for mirroring Kafka topics.
12
package main
23

34
import (
@@ -76,16 +77,16 @@ func toFranzOptions(brokerOpts BrokerOptions) ([]kgo.Opt, error) {
7677
out = append(out, kgo.SeedBrokers(brokerOpts.Brokers...))
7778
out = append(out, kgo.DialTimeout(brokerOpts.Timeout))
7879

79-
if brokerOpts.Tls.Enabled {
80+
if brokerOpts.TLS.Enabled {
8081
tlsConfig := &tls.Config{
8182
MinVersion: tls.VersionTLS12,
8283
Renegotiation: tls.RenegotiateFreelyAsClient,
8384
RootCAs: x509.NewCertPool(),
84-
InsecureSkipVerify: brokerOpts.Tls.Insecure,
85+
InsecureSkipVerify: brokerOpts.TLS.Insecure, // #nosec G402
8586
}
8687

87-
if brokerOpts.Tls.Cert != "" {
88-
if ok := tlsConfig.RootCAs.AppendCertsFromPEM([]byte(brokerOpts.Tls.Cert)); !ok {
88+
if brokerOpts.TLS.Cert != "" {
89+
if ok := tlsConfig.RootCAs.AppendCertsFromPEM([]byte(brokerOpts.TLS.Cert)); !ok {
8990
return nil, fmt.Errorf("failed to append cert to root CAs")
9091
}
9192
}

config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func BenchmarkParseTopicOffset(b *testing.B) {
248248
for _, tt := range tests {
249249
b.Run(tt, func(b *testing.B) {
250250
for i := 0; i < b.N; i++ {
251-
parseTopicOffset(tt)
251+
_, _ = parseTopicOffset(tt)
252252
}
253253
})
254254
}
@@ -264,7 +264,7 @@ func BenchmarkToTopic(b *testing.B) {
264264
for _, tt := range tests {
265265
b.Run(tt, func(b *testing.B) {
266266
for i := 0; i < b.N; i++ {
267-
toTopic(tt)
267+
_, _, _ = toTopic(tt)
268268
}
269269
})
270270
}

go.mod

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

3-
go 1.24.0
3+
go 1.26.0
44

55
tool golang.org/x/vuln/cmd/govulncheck
66

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log/slog"
7+
"math"
78
"time"
89

910
"github.com/twmb/franz-go/pkg/kadm"
@@ -211,7 +212,11 @@ func createTopic(rootCtx context.Context, client *kadm.Client, dt kadm.TopicDeta
211212
ctx, cancel := context.WithTimeout(rootCtx, config.Timeout)
212213
defer cancel()
213214

214-
partitions := int32(len(dt.Partitions))
215+
numPartitions := len(dt.Partitions)
216+
if numPartitions > int(math.MaxInt32) {
217+
return fmt.Errorf("number of partitions %d exceeds maximum int32 value", numPartitions)
218+
}
219+
partitions := int32(numPartitions) // #nosec G115
215220

216221
if _, err := client.CreateTopic(ctx, partitions, -1, nil, topic); err != nil {
217222
return fmt.Errorf("failed to create topic %q: %w", topic, err)

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ func BenchmarkWait(b *testing.B) {
9999

100100
b.ResetTimer()
101101
for i := 0; i < b.N; i++ {
102-
wait(time.Second, fn)
102+
_ = wait(time.Second, fn)
103103
}
104104
}

0 commit comments

Comments
 (0)