mirror of https://github.com/kubernetes/kops.git
Source gofmt from bazel go
Using the approach from k8s.io/repo-infra. This avoids problems where we are testing with a different version of go than we are building with.
This commit is contained in:
parent
de581b1b64
commit
bf4c4a1a95
|
|
@ -21,3 +21,10 @@ go_library(
|
|||
],
|
||||
importpath = "k8s.io/kops",
|
||||
)
|
||||
|
||||
load("@io_k8s_repo_infra//defs:run_in_workspace.bzl", "workspace_binary")
|
||||
|
||||
workspace_binary(
|
||||
name = "gofmt",
|
||||
cmd = "@go_sdk//:bin/gofmt",
|
||||
)
|
||||
|
|
|
|||
15
Makefile
15
Makefile
|
|
@ -500,20 +500,7 @@ dep-ensure: dep-prereqs
|
|||
|
||||
.PHONY: gofmt
|
||||
gofmt:
|
||||
gofmt -w -s channels/
|
||||
gofmt -w -s cloudmock/
|
||||
gofmt -w -s cmd/
|
||||
gofmt -w -s examples/
|
||||
gofmt -w -s nodeup/
|
||||
gofmt -w -s util/
|
||||
gofmt -w -s upup/pkg/
|
||||
gofmt -w -s pkg/
|
||||
gofmt -w -s tests/
|
||||
gofmt -w -s protokube/cmd
|
||||
gofmt -w -s protokube/pkg
|
||||
gofmt -w -s protokube/tests
|
||||
gofmt -w -s dns-controller/cmd
|
||||
gofmt -w -s dns-controller/pkg
|
||||
find -name "*.go" | grep -v vendor | xargs bazel run //:gofmt -- -w -s
|
||||
|
||||
.PHONY: goimports
|
||||
goimports:
|
||||
|
|
|
|||
|
|
@ -113,3 +113,10 @@ http_file(
|
|||
urls = ["https://kubeupv2.s3.amazonaws.com/kops/1.11.1/linux/amd64/utils.tar.gz"],
|
||||
sha256 = "0e685eb751a32f782705311049b2592c4724add6f19ffdad1e7ce4f55816d7d8",
|
||||
)
|
||||
|
||||
git_repository(
|
||||
name = "io_k8s_repo_infra",
|
||||
commit = "4ce715fbe67d8fbed05ec2bb47a148e754100a4b",
|
||||
remote = "https://github.com/kubernetes/repo-infra.git",
|
||||
shallow_since = "1517262872 -0800",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
. $(dirname "${BASH_SOURCE}")/common.sh
|
||||
|
||||
GOFMT="gofmt -s -w"
|
||||
GOFMT="bazel run //:gofmt -- -s -w"
|
||||
|
||||
bad_files=$(git ls-files "*.go" | grep -v vendor | xargs -I {} $GOFMT -l {})
|
||||
bad_files=$(git ls-files "*.go" | grep -v vendor | xargs $GOFMT -l)
|
||||
if [[ -n "${bad_files}" ]]; then
|
||||
echo "FAIL: '$GOFMT' needs to be run on the following files: "
|
||||
echo "${bad_files}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue