From f9cde7cd2b9c030634e39477a641392731f2f43d Mon Sep 17 00:00:00 2001 From: Gorka Lerchundi Osa Date: Wed, 10 Apr 2019 10:50:29 +0200 Subject: [PATCH] modules: pin dependencies and fix updategenerated Closes #996 Signed-off-by: Gorka Lerchundi Osa --- Makefile | 12 ++++++------ go.mod | 13 +++++++++++-- hack/update-generated-crd-code.sh | 11 ++++++----- tools.go | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 tools.go diff --git a/Makefile b/Makefile index 676409947e6..e5b9767ac1a 100644 --- a/Makefile +++ b/Makefile @@ -56,13 +56,13 @@ local: $(LOCAL_BOOTSTRAP_CONFIG) --service-cluster cluster0 staticcheck: - @go get honnef.co/go/tools/cmd/staticcheck + go install honnef.co/go/tools/cmd/staticcheck staticcheck \ -checks all,-ST1003 \ $(PKGS) misspell: - @go get github.com/client9/misspell/cmd/misspell + go install github.com/client9/misspell/cmd/misspell misspell \ -i clas \ -locale US \ @@ -70,21 +70,21 @@ misspell: cmd/* internal/* docs/* design/* *.md unconvert: - @go get github.com/mdempsky/unconvert + go install github.com/mdempsky/unconvert unconvert -v $(PKGS) ineffassign: - @go get github.com/gordonklaus/ineffassign + go install github.com/gordonklaus/ineffassign find $(SRCDIRS) -name '*.go' | xargs ineffassign pedantic: check unparam errcheck unparam: - @go get mvdan.cc/unparam + go install mvdan.cc/unparam unparam ./... errcheck: - @go get github.com/kisielk/errcheck + go install github.com/kisielk/errcheck errcheck $(PKGS) render: diff --git a/go.mod b/go.mod index c498eac4783..dccc943c27f 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.12 require ( cloud.google.com/go v0.37.4 // indirect + github.com/client9/misspell v0.3.4 github.com/envoyproxy/go-control-plane v0.6.9 github.com/evanphx/json-patch v4.1.0+incompatible github.com/ghodss/yaml v1.0.0 // indirect @@ -13,14 +14,15 @@ require ( github.com/google/go-cmp v0.2.0 github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect github.com/googleapis/gnostic v0.2.0 // indirect - github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc // indirect + github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect github.com/hashicorp/golang-lru v0.5.1 // indirect github.com/heptio/workgroup v0.8.0-beta.1 github.com/imdario/mergo v0.3.7 // indirect github.com/json-iterator/go v1.1.5 // indirect + github.com/kisielk/errcheck v1.2.0 github.com/lyft/protoc-gen-validate v0.0.12 // indirect - github.com/mdempsky/unconvert v0.0.0-20190325185700-2f5dc3378ed3 // indirect + github.com/mdempsky/unconvert v0.0.0-20190325185700-2f5dc3378ed3 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect @@ -33,12 +35,19 @@ require ( golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a // indirect golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 // indirect + golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 // indirect + gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect google.golang.org/grpc v1.19.1 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.2.2 // indirect + honnef.co/go/tools v0.0.0-20190315113450-95959eaf5e3c k8s.io/api v0.0.0-20190226173710-145d52631d00 k8s.io/apimachinery v0.0.0-20190221084156-01f179d85dbc k8s.io/client-go v0.0.0-20190226174127-78295b709ec6 + k8s.io/code-generator v0.0.0-20190409092313-b1289fc74931 + k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af // indirect + k8s.io/klog v0.0.0-20190306015804-8e90cee79f82 // indirect k8s.io/kube-openapi v0.0.0-20190115222348-ced9eb3070a5 // indirect + mvdan.cc/unparam v0.0.0-20190310220240-1b9ccfa71afe ) diff --git a/hack/update-generated-crd-code.sh b/hack/update-generated-crd-code.sh index 00d41b2e64e..10c178347fe 100755 --- a/hack/update-generated-crd-code.sh +++ b/hack/update-generated-crd-code.sh @@ -15,13 +15,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -HACK_DIR=$(dirname "${BASH_SOURCE}") -REPO_ROOT=${HACK_DIR}/.. - -${REPO_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \ +VERSION=$(go list -m all | grep k8s.io/code-generator | rev | cut -d"-" -f1 | cut -d" " -f1 | rev) +TMP_DIR=$(mktemp -d) +git clone https://github.com/kubernetes/code-generator.git ${TMP_DIR} +(cd ${TMP_DIR} && git reset --hard ${VERSION} && go mod init) +${TMP_DIR}/generate-groups.sh \ all \ github.com/heptio/contour/apis/generated \ github.com/heptio/contour/apis \ contour:v1beta1 \ --go-header-file hack/boilerplate.go.tmpl \ - $@ \ No newline at end of file + $@ diff --git a/tools.go b/tools.go new file mode 100644 index 00000000000..1d155b3d8c6 --- /dev/null +++ b/tools.go @@ -0,0 +1,18 @@ +// +build tools + +package tools + +import ( + _ "mvdan.cc/unparam" + _ "honnef.co/go/tools/cmd/staticcheck" + _ "github.com/client9/misspell/cmd/misspell" + _ "github.com/gordonklaus/ineffassign" + _ "github.com/mdempsky/unconvert" + _ "github.com/kisielk/errcheck" + + _ "k8s.io/code-generator/cmd/client-gen" + _ "k8s.io/code-generator/cmd/deepcopy-gen" + _ "k8s.io/code-generator/cmd/defaulter-gen" + _ "k8s.io/code-generator/cmd/lister-gen" + _ "k8s.io/code-generator/cmd/informer-gen" +)