Skip to content

Commit 6ef3f01

Browse files
committed
fix golangci reported issues
Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 88adf90 commit 6ef3f01

78 files changed

Lines changed: 141 additions & 106 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/certmanager/certificate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (c *Certificate) Delete(
158158

159159
err := h.GetClient().Delete(ctx, c.certificate)
160160
if err != nil && !k8s_errors.IsNotFound(err) {
161-
return fmt.Errorf("Error deleting certificate %s: %w", c.certificate.Name, err)
161+
return fmt.Errorf("error deleting certificate %s: %w", c.certificate.Name, err)
162162
}
163163

164164
return nil
@@ -177,7 +177,7 @@ func EnsureCert(
177177

178178
err := helper.GetClient().Get(ctx, types.NamespacedName{Name: request.IssuerName, Namespace: namespace}, issuer)
179179
if err != nil {
180-
err = fmt.Errorf("Error getting issuer %s/%s - %w", request.IssuerName, namespace, err)
180+
err = fmt.Errorf("error getting issuer %s/%s - %w", request.IssuerName, namespace, err)
181181

182182
return nil, ctrl.Result{}, err
183183
}

modules/certmanager/issuer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (i *Issuer) Delete(
159159

160160
err := h.GetClient().Delete(ctx, i.issuer)
161161
if err != nil && !k8s_errors.IsNotFound(err) {
162-
return fmt.Errorf("Error deleting issuer %s: %w", i.issuer.Name, err)
162+
return fmt.Errorf("error deleting issuer %s: %w", i.issuer.Name, err)
163163
}
164164

165165
return nil
@@ -177,7 +177,7 @@ func GetIssuerByName(
177177

178178
err := h.GetClient().Get(ctx, types.NamespacedName{Name: name, Namespace: namespace}, issuer)
179179
if err != nil {
180-
return nil, fmt.Errorf("Error getting issuer %s: %w", issuer.Name, err)
180+
return nil, fmt.Errorf("error getting issuer %s: %w", issuer.Name, err)
181181
}
182182

183183
return issuer, nil
@@ -204,7 +204,7 @@ func GetIssuerByLabels(
204204

205205
err := h.GetClient().List(ctx, issuers, listOpts...)
206206
if err != nil {
207-
return nil, fmt.Errorf("Error getting issuer by label: %w", err)
207+
return nil, fmt.Errorf("error getting issuer by label: %w", err)
208208
}
209209

210210
if len(issuers.Items) > 1 {

modules/common/affinity/affinity.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package affinity provides utilities for managing Kubernetes pod affinity and anti-affinity rules
1718
package affinity
1819

1920
import (

modules/common/affinity/affinity_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package affinity
1919
import (
2020
"testing"
2121

22-
. "github.com/onsi/gomega"
22+
. "github.com/onsi/gomega" // nolint:revive
2323

2424
corev1 "k8s.io/api/core/v1"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

modules/common/annotations/network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package annotations provides utilities for managing network annotations and network attachment definitions
1718
package annotations
1819

1920
import (

modules/common/annotations/network_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ limitations under the License.
1717
package annotations
1818

1919
import (
20-
. "github.com/onsi/gomega"
2120
"testing"
21+
22+
. "github.com/onsi/gomega" // nolint:revive
2223
)
2324

2425
func TestGetNADAnnotation(t *testing.T) {

modules/common/clusterdns/clusterdns.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package clusterdns provides utilities for DNS cluster domain operations
1718
package clusterdns
1819

1920
// GetDNSClusterDomain - Return openshift dns Cluster Domain name

modules/common/condition/conditions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
// +kubebuilder:object:generate:=true
1818

19+
// Package condition provides types and utilities for managing Kubernetes condition objects
1920
package condition
2021

2122
// Common Condition Types used by API objects.

modules/common/condition/funcs_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"testing"
2323
"time"
2424

25-
. "github.com/onsi/gomega"
25+
. "github.com/onsi/gomega" // nolint:revive
2626
"github.com/onsi/gomega/format"
2727
"github.com/onsi/gomega/types"
2828
"github.com/pkg/errors"
@@ -148,7 +148,7 @@ func TestSet(t *testing.T) {
148148
g.Expect(conditions).To(haveSameConditionsOf(CreateList(unknownReady)))
149149

150150
for _, tt := range tests {
151-
t.Run(tt.name, func(t *testing.T) {
151+
t.Run(tt.name, func(_ *testing.T) {
152152

153153
conditions.Set(tt.condition)
154154

@@ -224,7 +224,7 @@ func TestRemove(t *testing.T) {
224224
g := NewWithT(t)
225225

226226
for _, tt := range tests {
227-
t.Run(tt.name, func(t *testing.T) {
227+
t.Run(tt.name, func(_ *testing.T) {
228228
tt.conditions.Remove(tt.cType)
229229
g.Expect(tt.expected).To(haveSameConditionsOf(tt.conditions))
230230
})
@@ -256,7 +256,7 @@ func TestReset(t *testing.T) {
256256
g := NewWithT(t)
257257

258258
for _, tt := range tests {
259-
t.Run(tt.name, func(t *testing.T) {
259+
t.Run(tt.name, func(_ *testing.T) {
260260
tt.conditions.Reset()
261261
g.Expect(tt.expected).To(haveSameConditionsOf(tt.conditions))
262262
})
@@ -400,7 +400,7 @@ func TestAllSubConditionIsTrue(t *testing.T) {
400400
g.Expect(conditions).To(haveSameConditionsOf(CreateList(unknownReady)))
401401

402402
for _, tt := range tests {
403-
t.Run(tt.name, func(t *testing.T) {
403+
t.Run(tt.name, func(_ *testing.T) {
404404

405405
conditions.Set(tt.condition)
406406
g.Expect(conditions.AllSubConditionIsTrue()).To(BeIdenticalTo(tt.want))
@@ -651,14 +651,14 @@ func TestRestoreLastTransitionTimes(t *testing.T) {
651651
// LastTransitionTime should change to time2 when HasSameCondition() passes.
652652
{
653653
name: "Same condition state",
654-
patch: func(condition *Condition) {},
654+
patch: func(_ *Condition) {},
655655
want: time2,
656656
},
657657
}
658658

659659
g := NewWithT(t)
660660
for _, tt := range tests {
661-
t.Run(tt.name, func(t *testing.T) {
661+
t.Run(tt.name, func(_ *testing.T) {
662662
testCond := falseA.DeepCopy()
663663
testCond.LastTransitionTime = time1
664664
conditions := CreateList(testCond)

modules/common/configmap/configmap.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package configmap provides utilities for managing Kubernetes ConfigMap resources
1718
package configmap
1819

1920
import (
@@ -202,7 +203,7 @@ func EnsureConfigMaps(
202203
func GetConfigMaps(
203204
ctx context.Context,
204205
h *helper.Helper,
205-
obj client.Object,
206+
_ client.Object,
206207
configMaps []string,
207208
namespace string,
208209
envVars *map[string]env.Setter,
@@ -289,7 +290,7 @@ func VerifyConfigMap(
289290
ctrl.Result{RequeueAfter: requeueTimeout},
290291
nil
291292
}
292-
return "", ctrl.Result{}, fmt.Errorf("Get ConfigMap %s failed: %w", configMapName, err)
293+
return "", ctrl.Result{}, fmt.Errorf("get ConfigMap %s failed: %w", configMapName, err)
293294
}
294295

295296
// collect the ConfigMap values the caller expects to exist

0 commit comments

Comments
 (0)