-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Correct output dir for make codegen and performance enhancement. Fixes #2424 #3056
Conversation
github.com/go-sql-driver/mysql v1.4.1 | ||
github.com/go-swagger/go-swagger v0.23.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tools dep should not appear here surely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason theses tools appear here because of the existence of ./hack/tools.go
, this is the recommended way from code-generator
to manage build tool dependencies, see https://github.com/kubernetes/code-generator/blob/master/tools.go.
Having this deps in go.mod to avoid messing it up when running building scripts, and then we don't need to have a weird backup-mod
and restore-mod
.
hack/generate-proto.sh
Outdated
|
||
header "generating proto files" | ||
|
||
if [ ! -d "${REPO_ROOT}/vendor" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this what makes it slow? could we just have these checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The reason to make it slow is simply because of moving to go module
, see kubernetes/code-generator#69.
I add go mod vendor
here just because I want to make sure ./hack/generate-proto.sh
also works, no need to run make
.
@@ -103,19 +103,8 @@ MANIFESTS := $(shell find manifests -mindepth 2 -type f) | |||
E2E_MANIFESTS := $(shell find test/e2e/manifests -mindepth 2 -type f) | |||
E2E_EXECUTOR ?= pns | |||
# The sort puts _.primary first in the list. 'env LC_COLLATE=C' makes sure underscore comes first in both Mac and Linux. | |||
SWAGGER_FILES := $(shell find pkg/apiclient -name '*.swagger.json' | env LC_COLLATE=C sort) | |||
MOCK_FILES := $(shell find persist workflow -maxdepth 4 -not -path '/vendor/*' -not -path './ui/*' -path '*/mocks/*' -type f -name '*.go') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not delete this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have been moved to ./hack/update-swaggers.sh and ./hack/update-mocks.sh
.PHONY: swagger | ||
swagger: api/openapi-spec/swagger.json | ||
|
||
pkg/apis/workflow/v1alpha1/openapi_generated.go: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bug here, the file will never get updated since it's already existing.
MOCKERY_CMD="${GOPATH}/bin/mockery" | ||
${MOCKERY_CMD} -version | ||
|
||
MOCK_FILES=$(find persist workflow -maxdepth 4 -not -path '/vendor/*' -not -path './ui/*' -path '*/mocks/*' -type f -name '*.go') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is tricky, to generate a mock file, it needs to be exiting in a proper directory first.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This change:
argo
repo to any directory on your computer;make codegen
.Time cost for
make codegen
before:Now:
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.