Skip to content

Commit 6d492c4

Browse files
author
Steve Scaffidi
committed
Make the linters happy
1 parent 6782077 commit 6d492c4

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ linters:
2121
enable:
2222
- dupl
2323
- errcheck
24-
- exportloopref
24+
- copyloopvar
2525
- goconst
2626
- gocyclo
2727
- gofmt

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
2828
# This variable is used to construct full image tags for bundle and catalog images.
2929
#
3030
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
31-
# sscaffidi/istio-fortsa-bundle:$VERSION and sscaffidi/istio-fortsa-catalog:$VERSION.
32-
IMAGE_TAG_BASE ?= sscaffidi/istio-fortsa
31+
# ghcr.io/hercynium/istio-fortsa-bundle:$VERSION and ghcr.io/hercynium/istio-fortsa-catalog:$VERSION.
32+
IMAGE_TAG_BASE ?= ghcr.io/hercynium/istio-fortsa
3333

3434
# BUNDLE_IMG defines the image:tag used for the bundle.
3535
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
@@ -209,10 +209,10 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
209209
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
210210

211211
## Tool Versions
212-
KUSTOMIZE_VERSION ?= v5.3.0
213-
CONTROLLER_TOOLS_VERSION ?= v0.14.0
212+
KUSTOMIZE_VERSION ?= v5.4.3
213+
CONTROLLER_TOOLS_VERSION ?= v0.16.4 # v0.14.0
214214
ENVTEST_VERSION ?= release-0.17
215-
GOLANGCI_LINT_VERSION ?= v1.57.2
215+
GOLANGCI_LINT_VERSION ?= v1.61.0
216216

217217
.PHONY: kustomize
218218
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

cmd/main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ func main() {
174174
//+kubebuilder:scaffold:builder
175175

176176
// populate the Istio Data before even starting the controllers
177-
istioData.RefreshIstioData(context.TODO(), kubeClient)
177+
if err := istioData.RefreshIstioData(context.TODO(), kubeClient); err != nil {
178+
setupLog.Error(err, "unable to get initial istio data")
179+
os.Exit(1)
180+
}
178181

179182
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
180183
setupLog.Error(err, "unable to set up health check")

internal/util/istio/tags/test_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestGetTags(t *testing.T) {
6666
[]runtime.Object{
6767
invalidWebhook("invalid", "foo"),
6868
namespace("default", "canary"),
69-
namespace("test1", "canary"),
69+
namespace("test1", "stable"),
7070
},
7171
},
7272
{

internal/util/k8s/rollout/rollout.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ func DoRolloutRestart(ctx context.Context, client ctrlclient.Client, obj ctrlcli
3131
switch obj.GetObjectKind().GroupVersionKind().Kind {
3232
case "Deployment":
3333
objX := &appsv1.Deployment{}
34-
client.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, objX)
34+
err := client.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, objX)
35+
if err != nil {
36+
return err
37+
}
3538
patch := ctrlclient.StrategicMergeFrom(objX.DeepCopy())
3639
if objX.Spec.Template.ObjectMeta.Annotations == nil {
3740
objX.Spec.Template.ObjectMeta.Annotations = make(map[string]string)
@@ -44,7 +47,10 @@ func DoRolloutRestart(ctx context.Context, client ctrlclient.Client, obj ctrlcli
4447
return client.Patch(ctx, objX, patch)
4548
case "DaemonSet":
4649
objX := &appsv1.DaemonSet{}
47-
client.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, objX)
50+
err := client.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, objX)
51+
if err != nil {
52+
return err
53+
}
4854
patch := ctrlclient.StrategicMergeFrom(objX.DeepCopy())
4955
if objX.Spec.Template.ObjectMeta.Annotations == nil {
5056
objX.Spec.Template.ObjectMeta.Annotations = make(map[string]string)
@@ -55,7 +61,10 @@ func DoRolloutRestart(ctx context.Context, client ctrlclient.Client, obj ctrlcli
5561
return client.Patch(ctx, objX, patch)
5662
case "StatefulSet":
5763
objX := &appsv1.StatefulSet{}
58-
client.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, objX)
64+
err := client.Get(ctx, types.NamespacedName{Namespace: obj.GetNamespace(), Name: obj.GetName()}, objX)
65+
if err != nil {
66+
return err
67+
}
5968
patch := ctrlclient.StrategicMergeFrom(objX.DeepCopy())
6069
if objX.Spec.Template.ObjectMeta.Annotations == nil {
6170
objX.Spec.Template.ObjectMeta.Annotations = make(map[string]string)

test/e2e/e2e_suite_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ import (
2727
// Run e2e tests using the Ginkgo runner.
2828
func TestE2E(t *testing.T) {
2929
RegisterFailHandler(Fail)
30-
fmt.Fprintf(GinkgoWriter, "Starting istio-fortsa suite\n")
30+
_, _ = fmt.Fprintf(GinkgoWriter, "Starting istio-fortsa suite\n")
3131
RunSpecs(t, "e2e suite")
3232
}

test/utils/utils.go

+6-18
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,13 @@ const (
3333
certmanagerVersion = "v1.14.4"
3434
certmanagerURLTmpl = "https://github.com/jetstack/cert-manager/releases/download/%s/cert-manager.yaml"
3535

36-
istio1Version = "1.22.4"
37-
istioHelmChartRepo = "https://istio-release.storage.googleapis.com/charts"
38-
istio2Version = "1.23.1"
36+
//istio1Version = "1.22.4"
37+
//istioHelmChartRepo = "https://istio-release.storage.googleapis.com/charts"
38+
//istio2Version = "1.23.1"
3939
)
4040

41-
/*
42-
kind delete cluster
43-
kind create cluster --config kind-config.yaml
44-
45-
kubectl create ns istio-system
46-
47-
helm install istio-base-v1-22-4 https://istio-release.storage.googleapis.com/charts/base-1.22.4.tgz -n istio-system --set revision=test-1
48-
helm install istio-istiod-v1-22-4 https://istio-release.storage.googleapis.com/charts/istiod-1.22.4.tgz -n istio-system --set pilot.resources.requests.cpu=100m --set pilot.resources.requests.memory=128m --set revision=test-1
49-
helm install istio-istiod-v1-23-1 https://istio-release.storage.googleapis.com/charts/istiod-1.23.1.tgz -n istio-system --set pilot.resources.requests.cpu=100m --set pilot.resources.requests.memory=256m --set revision=test-2
50-
51-
*/
52-
5341
func warnError(err error) {
54-
fmt.Fprintf(GinkgoWriter, "warning: %v\n", err)
42+
_, _ = fmt.Fprintf(GinkgoWriter, "warning: %v\n", err)
5543
}
5644

5745
// InstallPrometheusOperator installs the prometheus Operator to be used to export the enabled metrics.
@@ -68,12 +56,12 @@ func Run(cmd *exec.Cmd) ([]byte, error) {
6856
cmd.Dir = dir
6957

7058
if err := os.Chdir(cmd.Dir); err != nil {
71-
fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err)
59+
_, _ = fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err)
7260
}
7361

7462
cmd.Env = append(os.Environ(), "GO111MODULE=on")
7563
command := strings.Join(cmd.Args, " ")
76-
fmt.Fprintf(GinkgoWriter, "running: %s\n", command)
64+
_, _ = fmt.Fprintf(GinkgoWriter, "running: %s\n", command)
7765
output, err := cmd.CombinedOutput()
7866
if err != nil {
7967
return output, fmt.Errorf("%s failed with error: (%v) %s", command, err, string(output))

0 commit comments

Comments
 (0)