Skip to content

Commit

Permalink
Fix the lint target (#1505)
Browse files Browse the repository at this point in the history
Fix the lint target

This fixes an issue with the `make lint` target, where if a developer
has golangci-lint installed and also has linter errors, the linter fails
with an error, causing the next case to fall through (and the old linter
is run).

This also fixes all of the linter errors that had somehow cropped up in
the repo.
  • Loading branch information
ian-howell authored and sarabala1979 committed Jul 31, 2019
1 parent e03287b commit 5c5c29a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ STATIC_BUILD=true
# build development images
DEV_IMAGE=false

GOLANGCI_EXISTS := $(shell command -v golangci-lint 2> /dev/null)

override LDFLAGS += \
-X ${PACKAGE}.version=${VERSION} \
-X ${PACKAGE}.buildDate=${BUILD_DATE} \
Expand Down Expand Up @@ -127,9 +129,12 @@ endif

.PHONY: lint
lint:
ifdef GOLANGCI_EXISTS
golangci-lint run --config golangci.yml
else
# Remove gometalinter after a migration time.
(command -v golangci-lint >/dev/null 2>&1 && golangci-lint run --config golangci.yml) || \
gometalinter --config gometalinter.json ./...
endif

.PHONY: test
test:
Expand Down
3 changes: 1 addition & 2 deletions cmd/argo/commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ func NewListCommand() *cobra.Command {
log.Fatal(err)
}

var tmpWorkFlows []wfv1.Workflow
tmpWorkFlows = wfList.Items
tmpWorkFlows := wfList.Items
for wfList.ListMeta.Continue != "" {
listOpts.Continue = wfList.ListMeta.Continue
wfList, err = wfClient.List(listOpts)
Expand Down
3 changes: 2 additions & 1 deletion cmd/argoexec/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package commands

import (
"encoding/json"
"github.com/argoproj/argo/util"
"os"

"github.com/argoproj/argo/util"

"github.com/argoproj/pkg/cli"
kubecli "github.com/argoproj/pkg/kube/cli"
log "github.com/sirupsen/logrus"
Expand Down
3 changes: 2 additions & 1 deletion workflow/controller/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package controller
import (
"encoding/json"
"fmt"
"strings"

"github.com/argoproj/argo/errors"
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/argoproj/argo/workflow/common"
"github.com/valyala/fasttemplate"
"strings"
)

// dagContext holds context information about this context's DAG
Expand Down
3 changes: 2 additions & 1 deletion workflow/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/argoproj/argo/util"
"io"
"io/ioutil"
"net/url"
Expand All @@ -20,6 +19,8 @@ import (
"syscall"
"time"

"github.com/argoproj/argo/util"

argofile "github.com/argoproj/pkg/file"
log "github.com/sirupsen/logrus"
apiv1 "k8s.io/api/core/v1"
Expand Down

0 comments on commit 5c5c29a

Please sign in to comment.