diff --git a/Makefile b/Makefile index fc234c65ae..4b57b92f19 100644 --- a/Makefile +++ b/Makefile @@ -123,6 +123,10 @@ lint: ## Go lint your code fmt: ## Go fmt your code hack/go-fmt.sh . +.PHONY: goimports +goimports: ## Go fmt your code + hack/goimports.sh . + .PHONY: vet vet: ## Apply go vet to all go files hack/go-vet.sh ./... diff --git a/hack/goimports.sh b/hack/goimports.sh new file mode 100755 index 0000000000..3925936d9f --- /dev/null +++ b/hack/goimports.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +REPO_NAME=$(basename "${PWD}") +if [ "$IS_CONTAINER" != "" ]; then + for TARGET in "${@}"; do + find "${TARGET}" -name '*.go' ! -path '*/vendor/*' ! -path '*/.build/*' -exec goimports -w {} \+ + done + git diff --exit-code +else + docker run -it --rm \ + --env IS_CONTAINER=TRUE \ + --volume "${PWD}:/go/src/sigs.k8s.io/${REPO_NAME}:z" \ + --workdir "/go/src/sigs.k8s.io/${REPO_NAME}" \ + openshift/origin-release:golang-1.12 \ + ./hack/goimports.sh "${@}" +fi diff --git a/pkg/client/mock/client_generated.go b/pkg/client/mock/client_generated.go index 11233bcb91..3314b9b9a1 100644 --- a/pkg/client/mock/client_generated.go +++ b/pkg/client/mock/client_generated.go @@ -5,11 +5,12 @@ package mock import ( + reflect "reflect" + ec2 "github.com/aws/aws-sdk-go/service/ec2" elb "github.com/aws/aws-sdk-go/service/elb" elbv2 "github.com/aws/aws-sdk-go/service/elbv2" gomock "github.com/golang/mock/gomock" - reflect "reflect" ) // MockClient is a mock of Client interface