Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7189644
Upgrade to Go 1.26.2 to fix compiler bugs
janisz May 21, 2026
48169a8
Update all tool modules to Go 1.26.2
janisz May 21, 2026
49006d3
Fix golangci-lint errors and disable modernize linter
janisz May 21, 2026
139f7cd
fix(tlscheck): support IPv6 validation for Go 1.26.2
janisz May 25, 2026
cce0a27
fix(test): increase pruning test timeout for Go 1.26.2 scheduling
janisz May 25, 2026
d025ce2
Add Go version upgrade guide
janisz May 25, 2026
5aa88c4
Make Go upgrade guide more generic and comprehensive
janisz May 25, 2026
c9231a4
Update golangci-lint to use Go 1.26
janisz May 26, 2026
500dc1b
fix(test): update URL parser error message for Go 1.26.2
janisz May 26, 2026
a9d0ae7
chore: bump Go version to 1.26.3
janisz Jun 10, 2026
b8d7bad
chore: bump tool modules to Go 1.26.3
janisz Jun 10, 2026
c9061f6
chore: update Konflux builder to Go 1.26.3
janisz Jun 10, 2026
2af2b8c
chore: bump operator tool modules to Go 1.26.3
janisz Jun 10, 2026
1504624
chore: bump scanner/hack/quay to Go 1.26.3
janisz Jun 10, 2026
de90a86
chore: remove Go version upgrade guide
janisz Jun 10, 2026
e733496
chore: update modernize linter TODO to ROX-35007
janisz Jun 10, 2026
97bf14e
ROX-35007: enable modernize linter with all checks disabled
janisz Jun 10, 2026
943cb45
ROX-35007: enable modernize/stditerators and auto-fix
janisz Jun 10, 2026
a70bfa7
ROX-35007: enable modernize/stringsbuilder,stringscut,stringscutprefi…
janisz Jun 10, 2026
75ab190
ROX-35007: enable modernize/testingcontext,fmtappendf and auto-fix
janisz Jun 10, 2026
fe7db89
ROX-35007: enable modernize/slicessort,mapsloop and auto-fix
janisz Jun 10, 2026
c81cd16
ROX-35007: enable modernize/minmax,slicescontains and auto-fix
janisz Jun 10, 2026
8830bea
ROX-35007: enable modernize/reflecttypefor and auto-fix
janisz Jun 10, 2026
0fe1a47
ROX-35007: enable modernize/rangeint and auto-fix
janisz Jun 10, 2026
4c2aa4d
ROX-35007: enable modernize/newexpr and auto-fix
janisz Jun 10, 2026
8f66af0
ROX-35007: enable modernize/any and auto-fix
janisz Jun 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 1 addition & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "2"
run:
timeout: 240m
go: "1.25"
go: "1.26"
build-tags:
- integration
- scanner_db_integration
Expand Down Expand Up @@ -169,23 +169,6 @@ linters:
- sensor\.DiagnoseConnectionFailure
- status\.Error
- utils\.Should
modernize:
disable:
- any
- fmtappendf
- mapsloop
- minmax
- rangeint
- reflecttypefor
- slicescontains
- slicessort
- stditerators
- stringsbuilder
- stringscut
- stringscutprefix
- stringsseq
- testingcontext
- waitgroup
exclusions:
generated: lax
rules:
Expand Down
2 changes: 1 addition & 1 deletion .konflux/konflux.check-go-builder-version.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.25@sha256:977bd041377a1367c8b102a460ae8e63f89905f7cf9d8235484ae658c9b47646
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.26@sha256:8bca01ace56d684c43f59d9c60c8e9516ee30c46e7d7357c2f9b526369d3fddf

WORKDIR /workspace

Expand Down
2 changes: 1 addition & 1 deletion .tekton/operator-index-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ spec:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: build-index-content
image: brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.25@sha256:977bd041377a1367c8b102a460ae8e63f89905f7cf9d8235484ae658c9b47646
image: brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_golang_1.26@sha256:8bca01ace56d684c43f59d9c60c8e9516ee30c46e7d7357c2f9b526369d3fddf
imagePullPolicy: IfNotPresent
workingDir: /var/workdir/source/operator
securityContext:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (suite *UsageDataStoreTestSuite) TestWalk() {
const N = page + 2
first := time.Now()
last := first
for i := 0; i < N; i++ {
for i := range N {
ts, _ := protocompat.ConvertTimeToTimestampOrError(last)
err = suite.datastore.Add(suite.hasWriteCtx, &storage.SecuredUnits{
Timestamp: ts,
Expand Down Expand Up @@ -134,7 +134,7 @@ func (suite *UsageDataStoreTestSuite) TestGetMax() {
const N = page + 2
first := time.Now()
last := first
for i := 0; i < N; i++ {
for i := range N {
ts, _ := protocompat.ConvertTimeToTimestampOrError(last)
err = suite.datastore.Add(suite.hasWriteCtx, &storage.SecuredUnits{
Timestamp: ts,
Expand Down
2 changes: 1 addition & 1 deletion central/alert/datastore/bench_postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func BenchmarkAlertDatabaseOps(b *testing.B) {

// Keep the count low in CI. You can run w/ higher numbers locally.
totalAlerts := 1000
for i := 0; i < totalAlerts; i++ {
for range totalAlerts {
id := uuid.NewV4().String()
ids = append(ids, id)
a := fixtures.GetAlertWithID(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func BenchmarkMany(b *testing.B) {
var alerts []*storage.Alert
const alertsNum = 10000
for i := 0; i < alertsNum; i++ {
for range alertsNum {
alert := &storage.Alert{}
err := testutils.FullInit(alert, testutils.UniqueInitializer(), testutils.JSONFieldsFilter)
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions central/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func New(notifications notifier.Processor) auditPkg.Auditor {
}

// SendAuditMessage will send an audit message for the specified request.
func (a *audit) SendAuditMessage(ctx context.Context, req interface{}, grpcMethod string,
func (a *audit) SendAuditMessage(ctx context.Context, req any, grpcMethod string,
authError interceptor.AuthStatus, requestError error) {
if !a.notifications.HasEnabledAuditNotifiers() {
return
Expand Down Expand Up @@ -78,7 +78,7 @@ var (
)
)

func (a *audit) newAuditMessage(ctx context.Context, req interface{}, grpcFullMethod string,
func (a *audit) newAuditMessage(ctx context.Context, req any, grpcFullMethod string,
authError interceptor.AuthStatus, requestError error) *v1.Audit_Message {
ri := requestinfo.FromContext(ctx)

Expand Down Expand Up @@ -148,10 +148,10 @@ func (a *audit) newAuditMessage(ctx context.Context, req interface{}, grpcFullMe
}

// UnaryServerInterceptor is the interceptor for audit logging
func (a *audit) UnaryServerInterceptor() func(ctx context.Context, req interface{},
info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler) (interface{}, error) {
func (a *audit) UnaryServerInterceptor() func(ctx context.Context, req any,
info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo,
handler grpc.UnaryHandler) (any, error) {
resp, err := handler(ctx, req)
go a.SendAuditMessage(ctx, req, info.FullMethod, interceptor.GetAuthErrorFromContext(ctx), err)
return resp, err
Expand Down
4 changes: 2 additions & 2 deletions central/audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ func (suite *AuditLogTestSuite) TestUserRequestsContinueToBeAudited() {
suite.Equal(v1.Audit_CLI, msg.GetMethod(), "User gRPC requests should have method=CLI")
}

func handler(err error) func(ctx context.Context, req interface{}) (interface{}, error) {
return func(ctx context.Context, req interface{}) (interface{}, error) {
func handler(err error) func(ctx context.Context, req any) (any, error) {
return func(ctx context.Context, req any) (any, error) {
return nil, err
}
}
6 changes: 3 additions & 3 deletions central/auth/m2m/generic_claim_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func getFriendlyName(claims map[string][]string) string {
}

func (*genericClaimExtractor) ExtractClaims(idToken *IDToken) (map[string][]string, error) {
var unstructured map[string]interface{}
var unstructured map[string]any
if err := idToken.Claims(&unstructured); err != nil {
return nil, errors.Wrap(err, "extracting claims")
}
Expand All @@ -62,7 +62,7 @@ func (*genericClaimExtractor) ExtractClaims(idToken *IDToken) (map[string][]stri
return claims, nil
}

func parse(unstructured map[string]interface{}, claims map[string][]string, pfx string) {
func parse(unstructured map[string]any, claims map[string][]string, pfx string) {
for key, value := range unstructured {
key = pfx + key
switch value := value.(type) {
Expand All @@ -76,7 +76,7 @@ func parse(unstructured map[string]interface{}, claims map[string][]string, pfx
claims[key] = append(claims[key], s)
}
}
case map[string]interface{}:
case map[string]any:
parse(value, claims, key+".")
default:
log.Debugf("Dropping value %v for claim %s since its a non-supported type %T", value, key, value)
Expand Down
16 changes: 8 additions & 8 deletions central/auth/m2m/generic_claim_extractor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
func Test_genericClaimExtractor(t *testing.T) {
testCases := []struct {
subject string
unstructured map[string]interface{}
unstructured map[string]any
roxClaims tokens.RoxClaims
}{
{
subject: "test-subject-email",
unstructured: map[string]interface{}{
unstructured: map[string]any{
"email": "test@something.com",
"something": "else",
"another": []string{"value", "of", "things"},
Expand All @@ -38,7 +38,7 @@ func Test_genericClaimExtractor(t *testing.T) {
},
{
subject: "test-subject-preferred_username",
unstructured: map[string]interface{}{
unstructured: map[string]any{
"preferred_username": "test-user",
"something": "else",
"another": []string{"value", "of", "things"},
Expand All @@ -60,7 +60,7 @@ func Test_genericClaimExtractor(t *testing.T) {
},
{
subject: "test-subject-full_name",
unstructured: map[string]interface{}{
unstructured: map[string]any{
"full_name": "i am the test user",
"something": "else",
"another": []string{"value", "of", "things"},
Expand All @@ -82,7 +82,7 @@ func Test_genericClaimExtractor(t *testing.T) {
},
{
subject: "test-subject-empty",
unstructured: map[string]interface{}{
unstructured: map[string]any{
"something": "else",
"another": []string{"value", "of", "things"},
},
Expand All @@ -102,15 +102,15 @@ func Test_genericClaimExtractor(t *testing.T) {
},
{
subject: "test-k8s",
unstructured: map[string]interface{}{
unstructured: map[string]any{
"aud": []string{"https://example.com"},
"exp": 1763119831,
"iat": 1763116231,
"iss": "https://example.com",
"jti": "6a5e8681-3b2a-44f2-9462-ecf16f52c779",
"kubernetes.io": map[string]interface{}{
"kubernetes.io": map[string]any{
"namespace": "stackrox",
"serviceaccount": map[string]interface{}{
"serviceaccount": map[string]any{
"name": "config-controller",
"uid": "3cd68f8a-7e72-44e7-af17-b283e7027980",
},
Expand Down
2 changes: 1 addition & 1 deletion central/auth/m2m/id_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func IssuerFromRawIDToken(rawIDToken string) (string, error) {
// This will be handled in a latter part, when the metadata from the provider will be used to verify the signature.
// This does not pose a security threat, since this is only used to optimize fetching of the correct TokenExchanger.
// The TokenExchanger will do the final validation of the token including it's signature.
_, err := jwt.ParseWithClaims(rawIDToken, standardClaims, func(token *jwt.Token) (interface{}, error) {
_, err := jwt.ParseWithClaims(rawIDToken, standardClaims, func(token *jwt.Token) (any, error) {
return nil, nil
}, jwt.WithoutClaimsValidation())

Expand Down
6 changes: 3 additions & 3 deletions central/auth/m2m/kube_claim_extractor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ func Test_kubeClaimExtractor(t *testing.T) {

claims, err := e.ExtractClaims(&IDToken{
Claims: func(v any) error {
*v.(*map[string]any) = map[string]interface{}{
*v.(*map[string]any) = map[string]any{
"aud": []string{"https://example.com"},
"exp": 1763119831,
"iat": 1763116231,
"iss": "https://example.com",
"jti": "6a5e8681-3b2a-44f2-9462-ecf16f52c779",
"kubernetes.io": map[string]interface{}{
"kubernetes.io": map[string]any{
"namespace": "stackrox",
"serviceaccount": map[string]interface{}{
"serviceaccount": map[string]any{
"name": "config-controller",
"uid": "3cd68f8a-7e72-44e7-af17-b283e7027980",
},
Expand Down
8 changes: 2 additions & 6 deletions central/auth/m2m/role_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package m2m
import (
"context"
"regexp"
"slices"

"github.com/pkg/errors"
roleDataStore "github.com/stackrox/rox/central/role/datastore"
Expand Down Expand Up @@ -73,10 +74,5 @@ func resolveRolesForClaims(ctx context.Context, claims map[string][]string, role
}

func valuesMatch(expr *regexp.Regexp, claimValues []string) bool {
for _, claimValue := range claimValues {
if expr.MatchString(claimValue) {
return true
}
}
return false
return slices.ContainsFunc(claimValues, expr.MatchString)
}
4 changes: 2 additions & 2 deletions central/auth/userpass/watch_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type watchHandler struct {
manager *basic.Manager
}

func (h *watchHandler) OnChange(dir string) (interface{}, error) {
func (h *watchHandler) OnChange(dir string) (any, error) {
htpasswdPath := filepath.Join(dir, htpasswdFile)
f, err := os.Open(htpasswdPath)
if err != nil {
Expand All @@ -25,7 +25,7 @@ func (h *watchHandler) OnChange(dir string) (interface{}, error) {
return htpasswd.ReadHashFile(f)
}

func (h *watchHandler) OnStableUpdate(val interface{}, err error) {
func (h *watchHandler) OnStableUpdate(val any, err error) {
var hashFile *htpasswd.HashFile
if err != nil {
log.Warnf("Error reading htpasswd file: %v. Basic (username/password) auth will be disabled until the issue is remediated", err)
Expand Down
5 changes: 3 additions & 2 deletions central/backgroundmigrations/runner/rollout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const (
testNamespace = "stackrox"
)

func int32Ptr(i int32) *int32 { return &i }
//go:fix inline
func int32Ptr(i int32) *int32 { return new(i) }

func newTestRolloutChecker(client *fake.Clientset) *k8sRolloutChecker {
return &k8sRolloutChecker{
Expand All @@ -32,7 +33,7 @@ func readyDeployment() *appsv1.Deployment {
Generation: 1,
},
Spec: appsv1.DeploymentSpec{
Replicas: int32Ptr(1),
Replicas: new(int32(1)),
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"app": "central"},
},
Expand Down
2 changes: 1 addition & 1 deletion central/backgroundmigrations/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func parseSkipMigrations() set.IntSet {
return set.NewIntSet()
}
s := set.NewIntSet()
for _, entry := range strings.Split(val, ",") {
for entry := range strings.SplitSeq(val, ",") {
n, err := strconv.Atoi(strings.TrimSpace(entry))
if err != nil {
log.Errorf("could not parse %q from %s, not skipping", entry, env.SkipBackgroundMigrations.EnvVar())
Expand Down
5 changes: 1 addition & 4 deletions central/baseimage/datastore/datastore_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ func (ds *datastoreImpl) UpsertImages(

// Process in chunks. This reduces pressure on storage and avoids parameter/time limits.
for start := 0; start < len(batch); start += upsertChunkSize {
end := start + upsertChunkSize
if end > len(batch) {
end = len(batch)
}
end := min(start+upsertChunkSize, len(batch))

if err := ds.storage.UpsertMany(ctx, batch[start:end]); err != nil {
return fmt.Errorf("upsert images chunk [%d:%d]: %w", start, end, err)
Expand Down
8 changes: 2 additions & 6 deletions central/baseimage/datastore/repository/datastore_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"slices"
"time"

repoStore "github.com/stackrox/rox/central/baseimage/store/repository/postgres"
Expand Down Expand Up @@ -215,10 +216,5 @@ func (d *datastoreImpl) DeleteRepository(ctx context.Context, id string) error {
}

func statusMatches(current storage.BaseImageRepository_Status, allowed []storage.BaseImageRepository_Status) bool {
for _, s := range allowed {
if current == s {
return true
}
}
return false
return slices.Contains(allowed, current)
}
11 changes: 6 additions & 5 deletions central/baseimage/datastore/repository/datastore_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ func newRepository(path, tagPattern string) *storage.BaseImageRepository {
}
}

//go:fix inline
func ptr(s string) *string {
return &s
return new(s)
}

func (s *BaseImageRepositoryDatastoreTestSuite) TestBaseImageRepositoryDatastore() {
Expand Down Expand Up @@ -210,7 +211,7 @@ func (s *BaseImageRepositoryDatastoreTestSuite) TestUserCtxOperationsDenied() {
_, err = s.datastore.UpdateStatus(s.normalUserCtx, "non-existent-id", StatusUpdate{Status: storage.BaseImageRepository_READY})
s.Error(err, "UpdateStatus should fail for user context without permissions")

_, err = s.datastore.UpdateConfiguration(s.normalUserCtx, "non-existent-id", ConfigUpdate{TagPattern: ptr("v*")})
_, err = s.datastore.UpdateConfiguration(s.normalUserCtx, "non-existent-id", ConfigUpdate{TagPattern: new("v*")})
s.Error(err, "UpdateConfiguration should fail for user context without permissions")
}

Expand Down Expand Up @@ -321,7 +322,7 @@ func (s *BaseImageRepositoryDatastoreTestSuite) TestUpsertRepository_InsertsProv
}

func (s *BaseImageRepositoryDatastoreTestSuite) TestUpdateConfiguration_NotFound() {
updated, err := s.datastore.UpdateConfiguration(s.imgAdminCtx, uuid.NewV4().String(), ConfigUpdate{TagPattern: ptr("v*")})
updated, err := s.datastore.UpdateConfiguration(s.imgAdminCtx, uuid.NewV4().String(), ConfigUpdate{TagPattern: new("v*")})

s.Nil(updated)
s.ErrorIs(err, errox.NotFound)
Expand Down Expand Up @@ -556,7 +557,7 @@ func (s *BaseImageRepositoryDatastoreTestSuite) TestUpdateStatus_OnlyIfStatus_Co
results := make(chan *storage.BaseImageRepository, numGoroutines)
errs := make(chan error, numGoroutines)

for i := 0; i < numGoroutines; i++ {
for range numGoroutines {
go func() {
updated, err := s.datastore.UpdateStatus(ctx, created.GetId(), StatusUpdate{
Status: storage.BaseImageRepository_QUEUED,
Expand All @@ -573,7 +574,7 @@ func (s *BaseImageRepositoryDatastoreTestSuite) TestUpdateStatus_OnlyIfStatus_Co

// Collect results.
var updatedCount int
for i := 0; i < numGoroutines; i++ {
for range numGoroutines {
updated := <-results
err := <-errs
s.NoError(err)
Expand Down
Loading