Skip to content

Commit

Permalink
Replace goimports python scripts with shell scripts, remove unnecessa…
Browse files Browse the repository at this point in the history
…ry .packages
  • Loading branch information
rifelpet committed Dec 11, 2020
1 parent c954099 commit a8a0b67
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 390 deletions.
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,11 @@ gofmt:

.PHONY: goimports
goimports:
hack/update-goimports
hack/update-goimports.sh

.PHONY: verify-goimports
verify-goimports:
hack/verify-goimports
hack/verify-goimports.sh

.PHONY: govet
govet: ${BINDATA_TARGETS}
Expand All @@ -429,10 +429,6 @@ verify-gofmt:
verify-gomod:
hack/verify-gomod.sh

.PHONY: verify-packages
verify-packages: ${BINDATA_TARGETS}
hack/verify-packages.sh

# find release notes, remove PR titles and output the rest to .build, then run misspell on all files
.PHONY: verify-misspelling
verify-misspelling:
Expand Down Expand Up @@ -481,14 +477,14 @@ verify-hashes:
# ci target is for developers, it aims to cover all the CI jobs
# verify-gendocs will call kops target
.PHONY: ci
ci: govet verify-gofmt verify-crds verify-gomod verify-goimports verify-boilerplate verify-bazel verify-misspelling verify-shellcheck verify-staticcheck verify-terraform verify-bindata nodeup examples test | verify-gendocs verify-packages verify-apimachinery
ci: govet verify-gofmt verify-crds verify-gomod verify-goimports verify-boilerplate verify-bazel verify-misspelling verify-shellcheck verify-staticcheck verify-terraform verify-bindata nodeup examples test | verify-gendocs verify-apimachinery
echo "Done!"

# we skip tasks that rely on bazel and are covered by other jobs
# verify-gofmt: uses bazel, covered by pull-kops-verify
# govet needs to be after verify-goimports because it generates bindata.go
.PHONY: quick-ci
quick-ci: verify-crds verify-goimports govet verify-boilerplate verify-bazel verify-misspelling verify-shellcheck verify-bindata | verify-gendocs verify-packages verify-apimachinery
quick-ci: verify-crds verify-goimports govet verify-boilerplate verify-bazel verify-misspelling verify-shellcheck verify-bindata | verify-gendocs verify-apimachinery
echo "Done!"

.PHONY: pr
Expand Down
213 changes: 0 additions & 213 deletions hack/.packages

This file was deleted.

17 changes: 0 additions & 17 deletions hack/lib/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions hack/lib/kubernetes/__init__.py

This file was deleted.

47 changes: 0 additions & 47 deletions hack/update-goimports

This file was deleted.

26 changes: 16 additions & 10 deletions hack/lib/kubernetes/devtools.py → hack/update-goimports.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env bash

# Copyright 2017 The Kubernetes Authors.
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,12 +14,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from os import path
set -o errexit
set -o nounset
set -o pipefail

def read_packages_file(repo_path):
packages = []
with open(path.join(repo_path, 'hack/.packages')) as packages_file:
for package in packages_file:
packages.append(package.replace('\n', ''))
return packages
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"

cd "${KOPS_ROOT}/hack" || exit 1

go build -o "${TOOLS_BIN}/goimports" golang.org/x/tools/cmd/goimports

cd "${KOPS_ROOT}" || exit 1

mapfile -t files < <(find . -type f -name '*.go' -not -path "./vendor/*")

"${TOOLS_BIN}/goimports" -w "${files[@]}"
Loading

0 comments on commit a8a0b67

Please sign in to comment.