Skip to content

Commit a6286fb

Browse files
committed
remove bundle injection, make golangci-lint config consistent
Signed-off-by: Joe Lanford <[email protected]>
1 parent 838dd0a commit a6286fb

27 files changed

+372
-238
lines changed

.bingo/Variables.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ $(BINGO): $(BINGO_DIR)/bingo.mod
2323
@echo "(re)installing $(GOBIN)/bingo-v0.9.0"
2424
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.9.0 "github.com/bwplotka/bingo"
2525

26-
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.55.2
26+
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.57.2
2727
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
2828
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
29-
@echo "(re)installing $(GOBIN)/golangci-lint-v1.55.2"
30-
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.55.2 "github.com/golangci/golangci-lint/cmd/golangci-lint"
29+
@echo "(re)installing $(GOBIN)/golangci-lint-v1.57.2"
30+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.57.2 "github.com/golangci/golangci-lint/cmd/golangci-lint"
3131

3232
GORELEASER := $(GOBIN)/goreleaser-v1.20.0
3333
$(GORELEASER): $(BINGO_DIR)/goreleaser.mod

.bingo/golangci-lint.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
22

3-
go 1.20
3+
go 1.21
44

5-
require github.com/golangci/golangci-lint v1.55.2 // cmd/golangci-lint
5+
toolchain go1.22.2
6+
7+
require github.com/golangci/golangci-lint v1.57.2 // cmd/golangci-lint

.bingo/golangci-lint.sum

Lines changed: 185 additions & 0 deletions
Large diffs are not rendered by default.

.bingo/variables.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010

1111
BINGO="${GOBIN}/bingo-v0.9.0"
1212

13-
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.55.2"
13+
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.57.2"
1414

1515
GORELEASER="${GOBIN}/goreleaser-v1.20.0"
1616

.golangci.yml

Lines changed: 74 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,77 @@
1+
########
2+
# NOTE
3+
#
4+
# This file is duplicated in the following repos:
5+
# - operator-framework/kubectl-operator
6+
# - operator-framework/catalogd
7+
# - operator-framework/operator-controller
8+
# - operator-framework/rukpak
9+
#
10+
# If you are making a change, please make it in ALL
11+
# of the above repositories!
12+
#
13+
# TODO: Find a way to have a shared golangci config.
14+
########
15+
16+
run:
17+
# Default timeout is 1m, up to give more room
18+
timeout: 4m
19+
120
linters:
2-
auto-fix: false
321
enable:
4-
- errcheck
5-
- goimports
6-
- golint
7-
- gosec
8-
- misspell
9-
- scopelint
10-
- unconvert
11-
- unparam
12-
- interfacer
13-
- nakedret
14-
- gocyclo
15-
- dupl
16-
- goconst
17-
- lll
18-
run:
22+
- asciicheck
23+
- bodyclose
24+
- errorlint
25+
- gci
26+
- gofmt
27+
- gosec
28+
- importas
29+
- misspell
30+
- nestif
31+
- nonamedreturns
32+
- prealloc
33+
- stylecheck
34+
- tparallel
35+
- unconvert
36+
- unparam
37+
- unused
38+
- whitespace
39+
1940
linters-settings:
20-
errcheck:
21-
check-type-assertions: true
22-
lll:
23-
line-length: 250
24-
dupl:
25-
threshold: 400
41+
gci:
42+
sections:
43+
- standard
44+
- dot
45+
- default
46+
- prefix(github.com/operator-framework)
47+
48+
# TODO: change this to `localmodule` when golangci-lint
49+
# is updated to 1.58+
50+
- prefix(github.com/operator-framework/kubectl-operator)
51+
custom-order: true
52+
53+
errorlint:
54+
errorf: false
55+
56+
importas:
57+
alias:
58+
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
59+
alias: metav1
60+
- pkg: k8s.io/apimachinery/pkg/api/errors
61+
alias: apierrors
62+
- pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
63+
alias: apiextensionsv1
64+
- pkg: k8s.io/apimachinery/pkg/util/runtime
65+
alias: utilruntime
66+
- pkg: "^k8s\\.io/api/([^/]+)/(v[^/]+)$"
67+
alias: $1$2
68+
- pkg: sigs.k8s.io/controller-runtime
69+
alias: ctrl
70+
- pkg: github.com/operator-framework/rukpak/api/v1alpha2
71+
alias: rukpakv1alpha2
72+
- pkg: github.com/blang/semver/v4
73+
alias: bsemver
74+
75+
output:
76+
formats:
77+
- format: tab

internal/cmd/catalog_add.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"io"
55
"time"
66

7-
"github.com/operator-framework/operator-registry/pkg/image/containerdregistry"
87
"github.com/sirupsen/logrus"
98
"github.com/spf13/cobra"
109
"github.com/spf13/pflag"
1110

11+
"github.com/operator-framework/operator-registry/pkg/image/containerdregistry"
12+
1213
"github.com/operator-framework/kubectl-operator/internal/cmd/internal/log"
1314
internalaction "github.com/operator-framework/kubectl-operator/internal/pkg/action"
1415
"github.com/operator-framework/kubectl-operator/pkg/action"
@@ -49,8 +50,4 @@ func bindCatalogAddFlags(fs *pflag.FlagSet, a *internalaction.CatalogAdd) {
4950
fs.StringVarP(&a.DisplayName, "display-name", "d", "", "display name of the index")
5051
fs.StringVarP(&a.Publisher, "publisher", "p", "", "publisher of the index")
5152
fs.DurationVar(&a.CleanupTimeout, "cleanup-timeout", time.Minute, "the amount of time to wait before cancelling cleanup")
52-
53-
fs.StringArrayVarP(&a.InjectBundles, "inject-bundles", "b", nil, "inject extra bundles into the index at runtime")
54-
fs.StringVarP(&a.InjectBundleMode, "inject-bundle-mode", "m", "", "mode to use to inject bundles")
55-
_ = fs.MarkHidden("inject-bundle-mode")
5653
}

internal/cmd/catalog_list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"time"
88

99
"github.com/spf13/cobra"
10-
v1 "k8s.io/api/core/v1"
10+
corev1 "k8s.io/api/core/v1"
1111
"k8s.io/apimachinery/pkg/util/duration"
1212

1313
"github.com/operator-framework/kubectl-operator/internal/cmd/internal/log"
@@ -23,15 +23,15 @@ func newCatalogListCmd(cfg *action.Configuration) *cobra.Command {
2323
Short: "List installed operator catalogs",
2424
Run: func(cmd *cobra.Command, args []string) {
2525
if allNamespaces {
26-
cfg.Namespace = v1.NamespaceAll
26+
cfg.Namespace = corev1.NamespaceAll
2727
}
2828
catalogs, err := l.Run(cmd.Context())
2929
if err != nil {
3030
log.Fatal(err)
3131
}
3232

3333
if len(catalogs) == 0 {
34-
if cfg.Namespace == v1.NamespaceAll {
34+
if cfg.Namespace == corev1.NamespaceAll {
3535
log.Print("No resources found")
3636
} else {
3737
log.Printf("No resources found in %s namespace.", cfg.Namespace)

internal/cmd/operator_describe.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ func newOperatorDescribeCmd(cfg *action.Configuration) *cobra.Command {
9393
for _, v := range out {
9494
fmt.Print(v)
9595
}
96-
9796
},
9897
}
9998

internal/cmd/operator_install.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import (
44
"fmt"
55
"time"
66

7-
"github.com/operator-framework/api/pkg/operators/v1alpha1"
87
"github.com/spf13/cobra"
98
"github.com/spf13/pflag"
109

10+
"github.com/operator-framework/api/pkg/operators/v1alpha1"
11+
1112
"github.com/operator-framework/kubectl-operator/internal/cmd/internal/log"
1213
internalaction "github.com/operator-framework/kubectl-operator/internal/pkg/action"
1314
"github.com/operator-framework/kubectl-operator/pkg/action"

internal/cmd/operator_list.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/spf13/cobra"
12-
v1 "k8s.io/api/core/v1"
12+
corev1 "k8s.io/api/core/v1"
1313
"k8s.io/apimachinery/pkg/util/duration"
1414

1515
"github.com/operator-framework/kubectl-operator/internal/cmd/internal/log"
@@ -26,15 +26,15 @@ func newOperatorListCmd(cfg *action.Configuration) *cobra.Command {
2626
Args: cobra.ExactArgs(0),
2727
Run: func(cmd *cobra.Command, args []string) {
2828
if allNamespaces {
29-
cfg.Namespace = v1.NamespaceAll
29+
cfg.Namespace = corev1.NamespaceAll
3030
}
3131
subs, err := l.Run(cmd.Context())
3232
if err != nil {
3333
log.Fatalf("list operators: %v", err)
3434
}
3535

3636
if len(subs) == 0 {
37-
if cfg.Namespace == v1.NamespaceAll {
37+
if cfg.Namespace == corev1.NamespaceAll {
3838
log.Print("No resources found")
3939
} else {
4040
log.Printf("No resources found in %s namespace.", cfg.Namespace)
@@ -60,7 +60,6 @@ func newOperatorListCmd(cfg *action.Configuration) *cobra.Command {
6060
_, _ = fmt.Fprintf(tw, "%s%s\t%s\t%s\t%s\t%s\t%s\n", sub.Spec.Package, ns, sub.Name, sub.Status.InstalledCSV, sub.Status.CurrentCSV, sub.Status.State, duration.HumanDuration(age))
6161
}
6262
_ = tw.Flush()
63-
6463
},
6564
}
6665
cmd.Flags().BoolVarP(&allNamespaces, "all-namespaces", "A", false, "list operators in all namespaces")

internal/cmd/operator_list_available.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
"github.com/spf13/cobra"
1212
"github.com/spf13/pflag"
13-
v1 "k8s.io/api/core/v1"
13+
corev1 "k8s.io/api/core/v1"
1414
"k8s.io/apimachinery/pkg/util/duration"
1515

1616
"github.com/operator-framework/kubectl-operator/internal/cmd/internal/log"
@@ -35,7 +35,7 @@ func newOperatorListAvailableCmd(cfg *action.Configuration) *cobra.Command {
3535
}
3636

3737
if len(operators) == 0 {
38-
if cfg.Namespace == v1.NamespaceAll {
38+
if cfg.Namespace == corev1.NamespaceAll {
3939
log.Print("No resources found")
4040
} else {
4141
log.Printf("No resources found in %s namespace.\n", cfg.Namespace)

0 commit comments

Comments
 (0)