Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Fix linting on master (#688)
Browse files Browse the repository at this point in the history
The lint pass is failing on `master`, and the only reason I see is that `golangci-lint` was silently updated, as we always use the last version.
That's why I pinned the tool to the current version to prevent from futur failures.

Here is the output:
```
golangci-lint run --config ./golangci.yml
cmd/duffle/upgrade_test.go:31:4: composites: `github.com/deislabs/duffle/pkg/bundle.InvocationImage` composite literal uses unkeyed fields (govet)
			{
			^
pkg/action/action_test.go:40:4: composites: `github.com/deislabs/duffle/pkg/bundle.InvocationImage` composite literal uses unkeyed fields (govet)
			{
			^
pkg/packager/export.go:42:9: nilness: impossible condition: nil != nil (govet)
	if err != nil {
	       ^
pkg/packager/import.go:43:9: nilness: impossible condition: nil != nil (govet)
	if err != nil {
	       ^
make: *** [lint] Error 1
Makefile:74: recipe for target 'lint' failed
```

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
  • Loading branch information
silvin-lubecki authored and radu-matei committed Apr 3, 2019
1 parent f22c0c9 commit ebd6715
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ lint:
HAS_DEP := $(shell $(CHECK) dep)
HAS_GOLANGCI := $(shell $(CHECK) golangci-lint)
HAS_GOIMPORTS := $(shell $(CHECK) goimports)
GOLANGCI_VERSION := v1.16.0

.PHONY: build-drivers
build-drivers:
Expand All @@ -88,7 +89,7 @@ ifndef HAS_DEP
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
endif
ifndef HAS_GOLANGCI
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_VERSION)
endif
ifndef HAS_GOIMPORTS
go get -u golang.org/x/tools/cmd/goimports
Expand All @@ -98,4 +99,3 @@ endif
.PHONY: goimports
goimports:
find . -name "*.go" | fgrep -v vendor/ | xargs goimports -w -local github.com/deislabs/duffle

2 changes: 1 addition & 1 deletion cmd/duffle/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestUpgradePersistsClaim(t *testing.T) {
Version: "0.1.0",
InvocationImages: []bundle.InvocationImage{
{
bundle.BaseImage{Image: "foo/bar:0.1.0", ImageType: "docker"},
BaseImage: bundle.BaseImage{Image: "foo/bar:0.1.0", ImageType: "docker"},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func mockBundle() *bundle.Bundle {
Version: "0.1.0",
InvocationImages: []bundle.InvocationImage{
{
bundle.BaseImage{Image: "foo/bar:0.1.0", ImageType: "docker"},
BaseImage: bundle.BaseImage{Image: "foo/bar:0.1.0", ImageType: "docker"},
},
},
Credentials: map[string]bundle.Location{
Expand Down
3 changes: 0 additions & 3 deletions pkg/packager/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ func NewExporter(source, dest, logsDir string, l loader.Loader, thin, unsigned b
}
ctx := context.Background()
cli.NegotiateAPIVersion(ctx)
if err != nil {
return nil, fmt.Errorf("cannot negotiate Docker client version: %v", err)
}

logs := filepath.Join(logsDir, "export-"+time.Now().Format("20060102150405"))

Expand Down
3 changes: 0 additions & 3 deletions pkg/packager/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ func NewImporter(source, destination string, load loader.Loader, verbose bool) (
return nil, err
}
cli.NegotiateAPIVersion(context.Background())
if err != nil {
return nil, fmt.Errorf("cannot negotiate Docker client version: %v", err)
}

return &Importer{
Source: source,
Expand Down

0 comments on commit ebd6715

Please sign in to comment.