From 96abc9b5bfa48c440de4086b6ef3e2ebdc3d5547 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Thu, 18 Jul 2019 21:04:56 -0400 Subject: [PATCH] Call goimports as well as gofmt when doing a `make fmt` (#7148) Closes #7147 --- Makefile | 3 ++- audit/hashstructure_test.go | 3 ++- builtin/logical/pki/path_root.go | 3 ++- helper/metricsutil/metricsutil.go | 3 ++- physical/foundationdb/foundationdb_test.go | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f605c8191f..a976c2fe78 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ EXTERNAL_TOOLS=\ github.com/mitchellh/gox \ github.com/kardianos/govendor \ github.com/client9/misspell/cmd/misspell -GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) +GOFMT_FILES?=$$(find . -name '*.go' | grep -v pb.go | grep -v vendor) GO_VERSION_MIN=1.11 CGO_ENABLED?=0 @@ -194,6 +194,7 @@ fmtcheck: #@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" fmt: + goimports -w $(GOFMT_FILES) gofmt -w $(GOFMT_FILES) assetcheck: diff --git a/audit/hashstructure_test.go b/audit/hashstructure_test.go index 0a361c373b..7f6c5a8694 100644 --- a/audit/hashstructure_test.go +++ b/audit/hashstructure_test.go @@ -5,11 +5,12 @@ import ( "crypto/sha256" "encoding/json" "fmt" - "github.com/go-test/deep" "reflect" "testing" "time" + "github.com/go-test/deep" + "github.com/hashicorp/vault/sdk/helper/certutil" "github.com/hashicorp/vault/sdk/helper/salt" "github.com/hashicorp/vault/sdk/helper/wrapping" diff --git a/builtin/logical/pki/path_root.go b/builtin/logical/pki/path_root.go index 927aea2f53..ec94909a0a 100644 --- a/builtin/logical/pki/path_root.go +++ b/builtin/logical/pki/path_root.go @@ -7,11 +7,12 @@ import ( "encoding/base64" "encoding/pem" "fmt" - "github.com/hashicorp/vault/sdk/helper/certutil" "reflect" "strings" "time" + "github.com/hashicorp/vault/sdk/helper/certutil" + "github.com/hashicorp/errwrap" "github.com/hashicorp/vault/sdk/framework" "github.com/hashicorp/vault/sdk/helper/errutil" diff --git a/helper/metricsutil/metricsutil.go b/helper/metricsutil/metricsutil.go index f8b799bd52..13db458029 100644 --- a/helper/metricsutil/metricsutil.go +++ b/helper/metricsutil/metricsutil.go @@ -4,11 +4,12 @@ import ( "bytes" "encoding/json" "fmt" + "strings" + "github.com/armon/go-metrics" "github.com/hashicorp/vault/sdk/logical" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/expfmt" - "strings" ) const ( diff --git a/physical/foundationdb/foundationdb_test.go b/physical/foundationdb/foundationdb_test.go index ae7cd201a2..97cdb50d4a 100644 --- a/physical/foundationdb/foundationdb_test.go +++ b/physical/foundationdb/foundationdb_test.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "testing" + "time" "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog"