From ae5c7d0664cb29e538b682ac2f7bc1e38c21fb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Fri, 10 Apr 2020 20:46:21 +0300 Subject: [PATCH] Adjust the makefile to support autogenerating content with 1.14 go modules --- Makefile | 15 ++++++++++----- go.sum | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f34b599b6..3f63e7e27 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,6 @@ go-in-docker: # Do not use directly -- use $(GO_MAKE_TARGET) -v $(shell pwd):/go/src/${PROJECT} \ -w /go/src/${PROJECT} \ -u $(shell id -u):$(shell id -g) \ - -e GO111MODULE=on \ -e GOARCH=$(GOARCH) \ golang:$(GO_VERSION) \ $(COMMAND) @@ -201,12 +200,15 @@ api-doc: --to gfm \ bin/tmp/${GROUP_VERSION}.md > docs/api/${GROUP_VERSION}.md -autogen: api-docs +autogen: $(MAKE) go-make TARGETS="go-autogen" go-autogen: /go/bin/deepcopy-gen /go/bin/defaulter-gen /go/bin/conversion-gen /go/bin/openapi-gen # Let the boilerplate be empty touch /tmp/boilerplate + # Need to do this, otherwise go mod thinks the state is dirty (for some reason) + go mod vendor + /go/bin/deepcopy-gen \ --input-dirs ${API_DIRS} \ --bounding-dirs ${APIS_DIR} \ @@ -228,12 +230,15 @@ go-autogen: /go/bin/deepcopy-gen /go/bin/defaulter-gen /go/bin/conversion-gen /g --output-package ${PROJECT}/pkg/openapi \ --report-filename pkg/openapi/violations.txt \ -h /tmp/boilerplate + + # These commands modify the env a bit, clean up after us too + $(MAKE) tidy -/go/bin/%: vendor - go install k8s.io/code-generator/cmd/$* +/go/bin/deepcopy-gen /go/bin/defaulter-gen /go/bin/conversion-gen: /go/bin/%: vendor + go get k8s.io/code-generator/cmd/$* /go/bin/openapi-gen: - go install k8s.io/kube-openapi/cmd/openapi-gen + go get k8s.io/kube-openapi/cmd/openapi-gen godoc2md: bin/cache/go/bin/godoc2md bin/cache/go/bin/godoc2md: diff --git a/go.sum b/go.sum index 35a618772..89ab308b2 100644 --- a/go.sum +++ b/go.sum @@ -585,6 +585,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191216052735-49a3e744a425 h1:VvQyQJN0tSuecqgcIxMWnnfG5kSmgy9KZR9sW3W5QeA= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=