Skip to content

Commit ef69b57

Browse files
committed
Use gofumpt
1 parent def0871 commit ef69b57

File tree

24 files changed

+41
-66
lines changed

24 files changed

+41
-66
lines changed

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ linters:
22
enable:
33
- errcheck
44
- exhaustive
5+
- gofumpt
56
- gosimple
67
- govet
78
- ineffassign

cmd/cluster-image-registry-operator/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ import (
2626

2727
const metricsPort = 60000
2828

29-
var (
30-
filesToWatch []string
31-
)
29+
var filesToWatch []string
3230

3331
func printVersion() {
3432
klog.Infof("Cluster Image Registry Operator Version: %s", version.Version)

pkg/metrics/server_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,8 @@ func TestImagePrunerInstallStatus(t *testing.T) {
197197
t.Errorf("expected metric %s to be 2, got %f", metricName, m.Gauge.GetValue())
198198
}
199199
}
200-
201200
})
202201
}
203-
204202
}
205203

206204
func findMetricsByCounter(buf io.ReadCloser, name string) []*io_prometheus_client.Metric {

pkg/resource/deployment_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func TestChecksum(t *testing.T) {
6161

6262
for _, test := range tests {
6363
t.Run(test.name, func(t *testing.T) {
64-
6564
ctx, cancel := context.WithCancel(context.Background())
6665
defer cancel()
6766

pkg/resource/podtemplatespec_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ func TestMakePodTemplateSpecWithTopologySpread(t *testing.T) {
133133
MatchLabels: map[string]string{"registry": "abc"},
134134
},
135135
},
136-
}},
136+
},
137+
},
137138
expected: []corev1.TopologySpreadConstraint{
138139
{
139140
MaxSkew: 2,

pkg/signals/signal.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import (
2222
"syscall"
2323
)
2424

25-
var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM}
26-
var onlyOneSignalHandler = make(chan struct{})
25+
var (
26+
shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM}
27+
onlyOneSignalHandler = make(chan struct{})
28+
)
2729

2830
// SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned
2931
// which is closed on one of these signals. If a second signal is caught, the program

pkg/storage/azure/azure.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@ const (
4545
storageExistsReasonAccountDeleted = "AccountDeleted"
4646
)
4747

48-
var (
49-
// storageAccountInvalidCharRe is a regular expression for characters that
50-
// cannot be used in Azure storage accounts names (i.e. that are not
51-
// numbers nor lower-case letters) and that are not upper-case letters. If
52-
// you use this regular expression to filter invalid characters, you also
53-
// need to strings.ToLower to get a valid storage account name or an empty
54-
// string.
55-
storageAccountInvalidCharRe = regexp.MustCompile(`[^0-9A-Za-z]`)
56-
)
48+
// storageAccountInvalidCharRe is a regular expression for characters that
49+
// cannot be used in Azure storage accounts names (i.e. that are not
50+
// numbers nor lower-case letters) and that are not upper-case letters. If
51+
// you use this regular expression to filter invalid characters, you also
52+
// need to strings.ToLower to get a valid storage account name or an empty
53+
// string.
54+
var storageAccountInvalidCharRe = regexp.MustCompile(`[^0-9A-Za-z]`)
5755

5856
// Azure holds configuration used to reach Azure's endpoints.
5957
type Azure struct {

pkg/storage/azure/azure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func TestGetConfig(t *testing.T) {
178178
}
179179

180180
func TestGenerateAccountName(t *testing.T) {
181-
var re = regexp.MustCompile(`^[0-9a-z]{3,24}$`)
181+
re := regexp.MustCompile(`^[0-9a-z]{3,24}$`)
182182
for _, infrastructureName := range []string{
183183
"",
184184
"foo",

pkg/storage/ibmcos/ibmcos.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ func (d *driver) CABundle() (string, bool, error) {
7777
// ConfigEnv configures the environment variables that will be
7878
// used in the image registry deployment.
7979
func (d *driver) ConfigEnv() (envs envvar.List, err error) {
80-
8180
_, err = d.UpdateEffectiveConfig()
8281
if err != nil {
8382
return
@@ -99,7 +98,6 @@ func (d *driver) ConfigEnv() (envs envvar.List, err error) {
9998
// UpdateEffectiveConfig updates the driver's local effective ImageRegistryConfig and returns the effective image
10099
// registry configuration based on infrastructure settings and any custom overrides.
101100
func (d *driver) UpdateEffectiveConfig() (*imageregistryv1.ImageRegistryConfigStorageIBMCOS, error) {
102-
103101
effectiveConfig := d.Config.DeepCopy()
104102

105103
if effectiveConfig == nil {
@@ -668,7 +666,6 @@ func (d *driver) bucketExists(bucketName string, serviceInstanceCRN string) erro
668666
// getIBMCOSClient returns a client that allows us to interact
669667
// with the IBM COS service.
670668
func (d *driver) getIBMCOSClient(serviceInstanceCRN string) (*s3.S3, error) {
671-
672669
infra, err := util.GetInfrastructure(d.Listers)
673670
if err != nil {
674671
return nil, err

pkg/storage/oss/oss.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,10 @@ func (d *driver) RemoveStorage(cr *imageregistryv1.Config) (bool, error) {
588588
return false, err
589589
}
590590
for _, upload := range lmur.Uploads {
591-
var imur = oss.InitiateMultipartUploadResult{Bucket: bucket.BucketName,
592-
Key: upload.Key, UploadID: upload.UploadID}
591+
imur := oss.InitiateMultipartUploadResult{
592+
Bucket: bucket.BucketName,
593+
Key: upload.Key, UploadID: upload.UploadID,
594+
}
593595
err = bucket.AbortMultipartUpload(imur)
594596
if err != nil {
595597
return false, err

0 commit comments

Comments
 (0)