Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 75 additions & 67 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,85 @@
# This file contains all available configuration options
# with their default values.

# options for analysis running
version: "2"
run:
# default concurrency is a available CPU number
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 10m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# output configuration options
output:
# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

issues:
# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
exclude-dirs:
- build
- client
- docs
- models
- restapi

# List of regexps of issue texts to exclude, empty list by default.
# But independently from this option we use default exclude patterns,
# it can be disabled by `exclude-use-default: false`. To list all
# excluded by default patterns execute `golangci-lint run --help`
exclude:
- G107
- G115 # Integer overflow conversion
- G402 # support scality DisableSSL
- G401 # Use of weak cryptographic primitive
- G501 # Blacklisted import `crypto/md5`: weak cryptographic primitive
- '"ok" shadows declaration'

# make issues output unique by line, default is true
uniq-by-line: true

linters:
enable:
- gosimple
- staticcheck
- unused
- govet
- copyloopvar
- gocyclo
- gofmt
- gosec
- unconvert
settings:
govet:
enable:
- shadow
settings:
printf:
funcs:
- Infof
- Warnf
- Errorf
- Fatalf
staticcheck:
checks:
- "all"
- "-ST1001"
- "-ST1003"
- "-ST1005"
- "-ST1008"
- "-ST1011"
- "-ST1016"
- "-ST1017"
- "-ST1019"
- "-ST1023"
- "-QF1001"
- "-QF1002"
- "-QF1003"
- "-QF1005"
- "-QF1006"
- "-QF1007"
- "-QF1008"
- "-QF1011"
- "-QF1012"
gosec:
excludes:
- G107
- G108
- G115
- G402
- G602
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules: []
paths:
- build
- client
- docs
- models
- restapi
- third_party$
- builtin$
- examples$
issues:
uniq-by-line: true
formatters:
enable:
- gci
- gofmt
- goimports
- copyloopvar

linters-settings:
govet:
enable:
- shadow

settings:
printf:
funcs:
- Infof
- Warnf
- Errorf
- Fatalf
exclusions:
generated: lax
paths:
- build
- client
- docs
- models
- restapi
- third_party$
- builtin$
- examples$
6 changes: 3 additions & 3 deletions Dockerfile.assisted-installer-build
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ FROM registry.access.redhat.com/ubi9/go-toolset:1.25 AS golang

ENV GOFLAGS=""

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

Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/openshift/assisted-installer

go 1.21
go 1.25.0

toolchain go1.25.5

require (
github.com/PuerkitoBio/rehttp v1.4.0
Expand Down
18 changes: 8 additions & 10 deletions src/assisted_installer_controller/assisted_installer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ import (
"sync/atomic"
"time"

"github.com/thoas/go-funk"

"github.com/hashicorp/go-version"
metal3v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
configv1 "github.com/openshift/api/config/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
certificatesv1 "k8s.io/api/certificates/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

mapiv1beta1 "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/assisted-installer/src/common"
"github.com/openshift/assisted-installer/src/config"
Expand All @@ -38,6 +29,13 @@ import (
"github.com/openshift/assisted-installer/src/ops"
"github.com/openshift/assisted-installer/src/utils"
"github.com/openshift/assisted-service/models"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/thoas/go-funk"
certificatesv1 "k8s.io/api/certificates/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
Expand Down Expand Up @@ -1345,7 +1343,7 @@ func (c *controller) uploadSummaryLogs(podName string, namespace string, sinceSe

if !ok {
msg := "Some Logs were not collected in summary"
c.log.Errorf(msg)
c.log.Error(msg)
return errors.New(msg)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,28 @@ import (
"testing"
"time"

batchV1 "k8s.io/api/batch/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apischema "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"

"github.com/go-openapi/strfmt"
"github.com/google/uuid"
metal3v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1"
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/assisted-installer/src/common"
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
certificatesv1 "k8s.io/api/certificates/v1"

"github.com/go-openapi/strfmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/sirupsen/logrus"
gomock "go.uber.org/mock/gomock"

configv1 "github.com/openshift/api/config/v1"
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/assisted-installer/src/common"
"github.com/openshift/assisted-installer/src/inventory_client"
"github.com/openshift/assisted-installer/src/k8s_client"
"github.com/openshift/assisted-installer/src/ops"
"github.com/openshift/assisted-service/models"
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/sirupsen/logrus"
gomock "go.uber.org/mock/gomock"
batchV1 "k8s.io/api/batch/v1"
certificatesv1 "k8s.io/api/certificates/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apischema "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
)

func TestValidator(t *testing.T) {
Expand Down
7 changes: 3 additions & 4 deletions src/assisted_installer_controller/operator_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ package assisted_installer_controller
import (
"context"

"github.com/openshift/assisted-installer/src/k8s_client"
"github.com/openshift/assisted-installer/src/utils"
"github.com/openshift/assisted-service/models"
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/sirupsen/logrus"
batchV1 "k8s.io/api/batch/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"

"github.com/openshift/assisted-installer/src/k8s_client"
"github.com/openshift/assisted-installer/src/utils"
"github.com/openshift/assisted-service/models"
)

const (
Expand Down
1 change: 0 additions & 1 deletion src/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/openshift/assisted-installer/src/k8s_client"
"github.com/openshift/assisted-installer/src/utils"
"github.com/openshift/assisted-service/models"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/thoas/go-funk"
Expand Down
3 changes: 1 addition & 2 deletions src/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package config
import (
"encoding/json"
"flag"
"os"

"fmt"
"os"

"github.com/kelseyhightower/envconfig"
"github.com/openshift/assisted-installer/src/utils"
Expand Down
3 changes: 1 addition & 2 deletions src/coreos_logger/coreos_installer_log_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"strconv"
"strings"

"github.com/openshift/assisted-installer/src/utils"

"github.com/openshift/assisted-installer/src/inventory_client"
"github.com/openshift/assisted-installer/src/utils"
"github.com/openshift/assisted-service/models"
"github.com/sirupsen/logrus"
)
Expand Down
10 changes: 4 additions & 6 deletions src/coreos_logger/coreos_installer_log_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package coreos_logger
import (
"io"

"github.com/openshift/assisted-installer/src/inventory_client"
"github.com/openshift/assisted-service/models"
gomock "go.uber.org/mock/gomock"

"github.com/sirupsen/logrus/hooks/test"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/openshift/assisted-installer/src/inventory_client"
"github.com/openshift/assisted-service/models"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
gomock "go.uber.org/mock/gomock"
)

var _ = Describe("Verify CoreosInstallerLogger", func() {
Expand Down
21 changes: 9 additions & 12 deletions src/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,28 @@ import (
"strings"
"time"

mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"

"golang.org/x/sync/errgroup"
v1 "k8s.io/api/core/v1"

"github.com/go-openapi/swag"
"github.com/google/uuid"
"github.com/openshift/assisted-installer/src/main/drymock"
"github.com/openshift/assisted-service/pkg/secretdump"
"github.com/openshift/assisted-service/pkg/validations"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/thoas/go-funk"

"github.com/openshift/assisted-installer/src/common"
"github.com/openshift/assisted-installer/src/config"
"github.com/openshift/assisted-installer/src/coreos_logger"
"github.com/openshift/assisted-installer/src/ignition"
"github.com/openshift/assisted-installer/src/inventory_client"
"github.com/openshift/assisted-installer/src/k8s_client"
"github.com/openshift/assisted-installer/src/main/drymock"
"github.com/openshift/assisted-installer/src/ops"
"github.com/openshift/assisted-installer/src/ops/execute"
"github.com/openshift/assisted-installer/src/utils"
"github.com/openshift/assisted-service/models"
"github.com/openshift/assisted-service/pkg/secretdump"
"github.com/openshift/assisted-service/pkg/validations"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"github.com/pkg/errors"
preinstallUtils "github.com/rh-ecosystem-edge/preinstall-utils/pkg"
"github.com/sirupsen/logrus"
"github.com/thoas/go-funk"
"golang.org/x/sync/errgroup"
v1 "k8s.io/api/core/v1"
)

// In dry run mode we prefer to get quick feedback about errors rather
Expand Down
Loading