Skip to content

Commit 914e44f

Browse files
Merge pull request #1469 from omer-vishlitzky/release-ocm-2.13
NO-ISSUE: upgrade go to 1.25
2 parents 9a04b42 + e8629e1 commit 914e44f

File tree

20 files changed

+146
-172
lines changed

20 files changed

+146
-172
lines changed

.golangci.yml

Lines changed: 74 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,84 @@
1-
# This file contains all available configuration options
2-
# with their default values.
3-
4-
# options for analysis running
1+
version: "2"
52
run:
6-
# default concurrency is a available CPU number
73
concurrency: 4
8-
9-
# timeout for analysis, e.g. 30s, 5m, default is 1m
10-
timeout: 10m
11-
12-
# exit code when at least one issue was found, default is 1
134
issues-exit-code: 1
14-
15-
# include test files or not, default is true
165
tests: true
17-
18-
# output configuration options
19-
output:
20-
# print lines of code with issue, default is true
21-
print-issued-lines: true
22-
23-
# print linter name in the end of issue text, default is true
24-
print-linter-name: true
25-
26-
issues:
27-
# which dirs to skip: issues from them won't be reported;
28-
# can use regexp here: generated.*, regexp is applied on full path;
29-
# default value is empty list, but default dirs are skipped independently
30-
# from this option's value (see skip-dirs-use-default).
31-
exclude-dirs:
32-
- build
33-
- client
34-
- docs
35-
- models
36-
- restapi
37-
38-
# List of regexps of issue texts to exclude, empty list by default.
39-
# But independently from this option we use default exclude patterns,
40-
# it can be disabled by `exclude-use-default: false`. To list all
41-
# excluded by default patterns execute `golangci-lint run --help`
42-
exclude:
43-
- G107
44-
- G115 # Integer overflow conversion
45-
- G402 # support scality DisableSSL
46-
- G401 # Use of weak cryptographic primitive
47-
- G501 # Blacklisted import `crypto/md5`: weak cryptographic primitive
48-
- '"ok" shadows declaration'
49-
50-
# make issues output unique by line, default is true
51-
uniq-by-line: true
52-
536
linters:
547
enable:
55-
- gosimple
56-
- staticcheck
57-
- unused
58-
- govet
8+
- copyloopvar
599
- gocyclo
60-
- gofmt
6110
- gosec
6211
- unconvert
12+
settings:
13+
govet:
14+
enable:
15+
- shadow
16+
settings:
17+
printf:
18+
funcs:
19+
- Infof
20+
- Warnf
21+
- Errorf
22+
- Fatalf
23+
staticcheck:
24+
checks:
25+
- "all"
26+
- "-ST1001"
27+
- "-ST1003"
28+
- "-ST1005"
29+
- "-ST1011"
30+
- "-ST1016"
31+
- "-ST1017"
32+
- "-ST1019"
33+
- "-ST1023"
34+
- "-QF1001"
35+
- "-QF1002"
36+
- "-QF1003"
37+
- "-QF1005"
38+
- "-QF1006"
39+
- "-QF1007"
40+
- "-QF1008"
41+
- "-QF1011"
42+
- "-QF1012"
43+
gosec:
44+
excludes:
45+
- G107
46+
- G108
47+
- G115
48+
- G402
49+
- G602
50+
exclusions:
51+
generated: lax
52+
presets:
53+
- comments
54+
- common-false-positives
55+
- legacy
56+
- std-error-handling
57+
rules: []
58+
paths:
59+
- build
60+
- client
61+
- docs
62+
- models
63+
- restapi
64+
- third_party$
65+
- builtin$
66+
- examples$
67+
issues:
68+
uniq-by-line: true
69+
formatters:
70+
enable:
71+
- gci
72+
- gofmt
6373
- goimports
64-
- copyloopvar
65-
66-
linters-settings:
67-
govet:
68-
enable:
69-
- shadow
70-
71-
settings:
72-
printf:
73-
funcs:
74-
- Infof
75-
- Warnf
76-
- Errorf
77-
- Fatalf
74+
exclusions:
75+
generated: lax
76+
paths:
77+
- build
78+
- client
79+
- docs
80+
- models
81+
- restapi
82+
- third_party$
83+
- builtin$
84+
- examples$

Dockerfile.assisted-installer-build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ FROM registry.access.redhat.com/ubi9/go-toolset:1.25 AS golang
22

33
ENV GOFLAGS=""
44

5-
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.8 && \
6-
go install golang.org/x/tools/cmd/goimports@v0.1.0 && \
5+
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0 && \
6+
go install golang.org/x/tools/cmd/goimports@v0.34.0 && \
77
go install github.com/onsi/ginkgo/ginkgo@v1.16.1 && \
88
go install go.uber.org/mock/mockgen@v0.4.0 && \
9-
go install gotest.tools/gotestsum@v1.6.3 && \
9+
go install gotest.tools/gotestsum@v1.12.3 && \
1010
go install github.com/axw/gocov/gocov@v1.1.0 && \
1111
go install github.com/AlekSi/gocov-xml@v1.1.0
1212

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/openshift/assisted-installer
22

3-
go 1.21
3+
go 1.25.0
4+
5+
toolchain go1.25.5
46

57
require (
68
github.com/PuerkitoBio/rehttp v1.4.0

src/assisted_installer_controller/assisted_installer_controller.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,9 @@ import (
1818
"sync/atomic"
1919
"time"
2020

21-
"github.com/thoas/go-funk"
22-
2321
"github.com/hashicorp/go-version"
2422
metal3v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
2523
configv1 "github.com/openshift/api/config/v1"
26-
"github.com/pkg/errors"
27-
"github.com/sirupsen/logrus"
28-
certificatesv1 "k8s.io/api/certificates/v1"
29-
v1 "k8s.io/api/core/v1"
30-
apierrors "k8s.io/apimachinery/pkg/api/errors"
31-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32-
3324
mapiv1beta1 "github.com/openshift/api/machine/v1beta1"
3425
"github.com/openshift/assisted-installer/src/common"
3526
"github.com/openshift/assisted-installer/src/config"
@@ -38,6 +29,13 @@ import (
3829
"github.com/openshift/assisted-installer/src/ops"
3930
"github.com/openshift/assisted-installer/src/utils"
4031
"github.com/openshift/assisted-service/models"
32+
"github.com/pkg/errors"
33+
"github.com/sirupsen/logrus"
34+
"github.com/thoas/go-funk"
35+
certificatesv1 "k8s.io/api/certificates/v1"
36+
v1 "k8s.io/api/core/v1"
37+
apierrors "k8s.io/apimachinery/pkg/api/errors"
38+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4139
)
4240

4341
const (
@@ -472,7 +470,7 @@ func (c *controller) PostInstallConfigs(ctx context.Context, wg *sync.WaitGroup)
472470
}
473471

474472
errMessage := ""
475-
err, data := c.postInstallConfigs(ctx)
473+
data, err := c.postInstallConfigs(ctx)
476474
// Even if the context was cancelled, the error is sent to the assisted service.
477475
// The timeouts will be handled by the service
478476
if err != nil {
@@ -487,7 +485,7 @@ func (c *controller) PostInstallConfigs(ctx context.Context, wg *sync.WaitGroup)
487485
c.sendCompleteInstallation(ctx, success, errMessage, data)
488486
}
489487

490-
func (c *controller) postInstallConfigs(ctx context.Context) (error, map[string]interface{}) {
488+
func (c *controller) postInstallConfigs(ctx context.Context) (map[string]interface{}, error) {
491489
var err error
492490
var data map[string]interface{}
493491

@@ -499,12 +497,12 @@ func (c *controller) postInstallConfigs(ctx context.Context) (error, map[string]
499497
data = map[string]interface{}{clusterOperatorReportKey: report}
500498
}
501499
if err != nil {
502-
return errors.Wrapf(err, "Stopped waiting for cluster operators to be available"), data
500+
return data, errors.Wrapf(err, "Stopped waiting for cluster operators to be available")
503501
}
504502

505503
err = c.waitOnStage(ctx, models.FinalizingStageAddingRouterCa, failedOperatorRetry*time.Second, c.addRouterCAToClusterCA)
506504
if err != nil {
507-
return errors.Wrapf(err, "Stopped waiting for router ca data"), data
505+
return data, errors.Wrapf(err, "Stopped waiting for router ca data")
508506
}
509507

510508
// Wait for OLM operators

src/assisted_installer_controller/assisted_installer_controller_test.go

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,28 @@ import (
1414
"testing"
1515
"time"
1616

17-
batchV1 "k8s.io/api/batch/v1"
18-
v1 "k8s.io/api/core/v1"
19-
apierrors "k8s.io/apimachinery/pkg/api/errors"
20-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21-
apischema "k8s.io/apimachinery/pkg/runtime/schema"
22-
"k8s.io/apimachinery/pkg/types"
23-
17+
"github.com/go-openapi/strfmt"
2418
"github.com/google/uuid"
2519
metal3v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
26-
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
27-
"github.com/openshift/assisted-installer/src/common"
28-
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
29-
certificatesv1 "k8s.io/api/certificates/v1"
30-
31-
"github.com/go-openapi/strfmt"
3220
. "github.com/onsi/ginkgo"
3321
. "github.com/onsi/gomega"
34-
"github.com/sirupsen/logrus"
35-
gomock "go.uber.org/mock/gomock"
36-
3722
configv1 "github.com/openshift/api/config/v1"
23+
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
24+
"github.com/openshift/assisted-installer/src/common"
3825
"github.com/openshift/assisted-installer/src/inventory_client"
3926
"github.com/openshift/assisted-installer/src/k8s_client"
4027
"github.com/openshift/assisted-installer/src/ops"
4128
"github.com/openshift/assisted-service/models"
29+
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
30+
"github.com/sirupsen/logrus"
31+
gomock "go.uber.org/mock/gomock"
32+
batchV1 "k8s.io/api/batch/v1"
33+
certificatesv1 "k8s.io/api/certificates/v1"
34+
v1 "k8s.io/api/core/v1"
35+
apierrors "k8s.io/apimachinery/pkg/api/errors"
36+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
37+
apischema "k8s.io/apimachinery/pkg/runtime/schema"
38+
"k8s.io/apimachinery/pkg/types"
4239
)
4340

4441
func TestValidator(t *testing.T) {

src/assisted_installer_controller/operator_handler.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ package assisted_installer_controller
33
import (
44
"context"
55

6+
"github.com/openshift/assisted-installer/src/k8s_client"
7+
"github.com/openshift/assisted-installer/src/utils"
8+
"github.com/openshift/assisted-service/models"
69
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
710
"github.com/sirupsen/logrus"
811
batchV1 "k8s.io/api/batch/v1"
912
v1 "k8s.io/api/core/v1"
1013
apierrors "k8s.io/apimachinery/pkg/api/errors"
1114
"k8s.io/apimachinery/pkg/types"
12-
13-
"github.com/openshift/assisted-installer/src/k8s_client"
14-
"github.com/openshift/assisted-installer/src/utils"
15-
"github.com/openshift/assisted-service/models"
1615
)
1716

1817
const (

src/common/common.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/openshift/assisted-installer/src/k8s_client"
1616
"github.com/openshift/assisted-installer/src/utils"
1717
"github.com/openshift/assisted-service/models"
18-
1918
"github.com/pkg/errors"
2019
"github.com/sirupsen/logrus"
2120
"github.com/thoas/go-funk"

src/common/common_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ var _ = Describe("verify common", func() {
259259
}
260260

261261
for _, test := range tests {
262-
test := test
262+
263263
It(fmt.Sprintf("platform %v, invoker %v, version %v, cluster %v, is expected to remove uninitialized taint = %v", test.PlatformType, test.Invoker, test.VersionOpenshift, test.Cluster, test.ExpectedRemoveUninitializedTaint), func() {
264264
if test.PlatformType == models.PlatformTypeVsphere {
265265
mockbmclient.EXPECT().GetCluster(gomock.Any(), false).Return(test.Cluster, nil).Times(1)
@@ -306,7 +306,7 @@ var _ = Describe("verify common", func() {
306306
}
307307

308308
for _, test := range tests {
309-
test := test
309+
310310
It(test.TestName, func() {
311311
mockbmclient.EXPECT().GetCluster(gomock.Any(), false).Return(test.Cluster, nil).Times(1)
312312
hasValidvSphereCredentials := HasValidvSphereCredentials(context.TODO(), mockbmclient, mockkcclient, l)
@@ -352,7 +352,7 @@ var _ = Describe("verify common", func() {
352352
}
353353

354354
for _, test := range configMapTests {
355-
test := test
355+
356356
It(test.TestName, func() {
357357
mockbmclient.EXPECT().GetCluster(gomock.Any(), false).Return(nil, errors.New("some error")).Times(1)
358358
mockkcclient.EXPECT().GetConfigMap(gomock.Any(), gomock.Any()).Return(test.ConfigMap, nil).Times(1)

src/config/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package config
33
import (
44
"encoding/json"
55
"flag"
6-
"os"
7-
86
"fmt"
7+
"os"
98

109
"github.com/kelseyhightower/envconfig"
1110
"github.com/openshift/assisted-installer/src/utils"

src/coreos_logger/coreos_installer_log_writer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
66
"strconv"
77
"strings"
88

9-
"github.com/openshift/assisted-installer/src/utils"
10-
119
"github.com/openshift/assisted-installer/src/inventory_client"
10+
"github.com/openshift/assisted-installer/src/utils"
1211
"github.com/openshift/assisted-service/models"
1312
"github.com/sirupsen/logrus"
1413
)

0 commit comments

Comments
 (0)