Skip to content

Commit f69d8bc

Browse files
committed
Replace gometalinter with GolangCI-Lint
Running test.sh is down from 34s to 20s on my machine. Also, from now on, run go lint. Signed-off-by: David Gageot <[email protected]>
1 parent fb63e19 commit f69d8bc

File tree

5 files changed

+20
-39
lines changed

5 files changed

+20
-39
lines changed

Diff for: hack/gometalinter.json

-20
This file was deleted.

Diff for: hack/gometalinter.sh renamed to hack/linter.sh

+17-13
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@
1616

1717
set -e -o pipefail
1818

19-
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
20-
21-
install_gometalinter() {
22-
echo "Installing gometalinter.v2"
23-
go get -u gopkg.in/alecthomas/gometalinter.v2
24-
gometalinter.v2 --install
25-
}
26-
27-
if ! [ -x "$(command -v gometalinter.v2)" ]; then
28-
install_gometalinter
19+
if ! [ -x "$(command -v golangci-lint)" ]; then
20+
echo "Installing GolangCI-Lint"
21+
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
2922
fi
3023

31-
gometalinter.v2 \
32-
--deadline 5m \
33-
--config $SCRIPTDIR/gometalinter.json ./...
24+
golangci-lint run \
25+
--no-config \
26+
-E goimports \
27+
-E interfacer \
28+
-E unconvert \
29+
-E goconst \
30+
-E maligned \
31+
-D errcheck
32+
33+
# From now on, run go lint.
34+
golangci-lint run \
35+
--disable-all \
36+
-E golint \
37+
--new-from-rev bed41e9a77431990cc8504c0955252c851934b89

Diff for: pkg/skaffold/kubernetes/log.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ func NewLogAggregator(out io.Writer, podSelector PodSelector, colorPicker ColorP
6060
}
6161

6262
func (a *LogAggregator) Start(ctx context.Context) error {
63-
// Start logs
6463
kubeclient, err := Client()
6564
if err != nil {
6665
return errors.Wrap(err, "getting k8s client")
@@ -101,8 +100,7 @@ func (a *LogAggregator) Start(ctx context.Context) error {
101100
return nil
102101
}
103102

104-
// nolint: interfacer
105-
func (a *LogAggregator) streamLogs(ctx context.Context, client corev1.CoreV1Interface, pod *v1.Pod) error {
103+
func (a *LogAggregator) streamLogs(ctx context.Context, client corev1.PodsGetter, pod *v1.Pod) error {
106104
pods := client.Pods(pod.Namespace)
107105
if err := WaitForPodReady(pods, pod.Name); err != nil {
108106
return errors.Wrap(err, "waiting for pod ready")

Diff for: pkg/skaffold/kubernetes/wait.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ func (s *PodStore) Stop() {
116116
close(s.stopCh)
117117
}
118118

119-
// nolint: interfacer
120-
func NewPodStore(c kubernetes.Interface, namespace string, label labels.Selector, field fields.Selector) *PodStore {
119+
func NewPodStore(c kubernetes.Interface, namespace string, label fmt.Stringer, field fmt.Stringer) *PodStore {
121120
lw := &cache.ListWatch{
122121
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
123122
options.LabelSelector = label.String()

Diff for: test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ echo "Running validation scripts..."
3131
scripts=(
3232
"hack/boilerplate.sh"
3333
"hack/gofmt.sh"
34-
"hack/gometalinter.sh"
34+
"hack/linter.sh"
3535
"hack/dep.sh"
3636
)
3737
fail=0

0 commit comments

Comments
 (0)