Skip to content

Commit ad8a566

Browse files
Use golangci-lint 2.x (#130)
/cherry-pick Signed-off-by: Arnab Baishnab Nipun <nipun@appscode.com>
1 parent d0402b4 commit ad8a566

5 files changed

Lines changed: 35 additions & 52 deletions

File tree

.golangci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "2"
2+
linters:
3+
default: standard
4+
enable:
5+
- unparam
6+
7+
formatters:
8+
enable:
9+
- gofmt
10+
- goimports
11+
settings:
12+
gofmt:
13+
rewrite-rules:
14+
- pattern: 'interface{}'
15+
replacement: 'any'
16+
17+
issues:
18+
max-same-issues: 100
19+
20+
exclude-files:
21+
- generated.*\\.go
22+
23+
exclude-dirs:
24+
- client
25+
- vendor
26+
27+
run:
28+
timeout: 10m

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ lint: $(BUILD_DIRS)
281281
--env GO111MODULE=on \
282282
--env GOFLAGS="-mod=vendor" \
283283
$(BUILD_IMAGE) \
284-
golangci-lint run --enable $(ADDTL_LINTERS) --timeout=30m --exclude-files="generated.*\.go$\" --exclude-dirs-use-default --exclude-dirs=client,vendor
284+
golangci-lint run
285285

286286
$(BUILD_DIRS):
287287
@mkdir -p $@

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module stash.appscode.dev/etcd
22

3-
go 1.23.0
4-
5-
toolchain go1.24.4
3+
go 1.24.0
64

75
require (
86
github.com/spf13/cobra v1.8.0

lintconf.yaml

Lines changed: 0 additions & 43 deletions
This file was deleted.

pkg/util.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func (opt *options) createRestorePods(memberPod corev1.Pod, args []string) (*cor
194194

195195
for _, vol := range memberPod.Spec.Volumes {
196196
if vol.Name == dataVolume {
197-
pvcName = vol.VolumeSource.PersistentVolumeClaim.ClaimName
197+
pvcName = vol.PersistentVolumeClaim.ClaimName
198198
break
199199
}
200200
}
@@ -285,7 +285,7 @@ func (opt *options) replaceOldDataWithRestoredData(restorePods []corev1.Pod) err
285285
command := []string{StashEtcd, "replace"}
286286
command = append(command, "--data-dir="+opt.etcd.dataDir)
287287

288-
execOut, err := opt.execCommandOnPod(&pod, pod.ObjectMeta.Name, command)
288+
execOut, err := opt.execCommandOnPod(&pod, pod.Name, command)
289289
if err != nil {
290290
return err
291291
}
@@ -388,7 +388,7 @@ func (opt *options) getEtcdMemberPods() ([]corev1.Pod, error) {
388388
}
389389
return []corev1.Pod{*pod}, nil
390390
default:
391-
return nil, errors.New("Could not find any member for etcd server")
391+
return nil, errors.New("could not find any member for etcd server")
392392
}
393393
}
394394

@@ -422,7 +422,7 @@ func (opt *options) execCommandOnPod(pod *corev1.Pod, containerName string, comm
422422
Tty: true,
423423
})
424424
if err != nil {
425-
return nil, fmt.Errorf("Could not execute: %v, reason: %s", err, execErr.String())
425+
return nil, fmt.Errorf("could not execute: %v, reason: %s", err, execErr.String())
426426
}
427427

428428
return execOut.Bytes(), nil
@@ -545,7 +545,7 @@ func (opt *options) getCredential(appBinding *appcatalog.AppBinding) ([]string,
545545
tlsArgs = fmt.Sprintf("--key=%v", filepath.Join(opt.setupOptions.ScratchDir, EtcdClientKeyFile))
546546
args = append(args, tlsArgs)
547547
} else {
548-
return nil, errors.New("Client cert and client key needed for TLS secured operation")
548+
return nil, errors.New("client cert and client key needed for TLS secured operation")
549549
}
550550

551551
return args, nil

0 commit comments

Comments
 (0)