Skip to content
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

Fake being in GOPATH when generating code. #1253

Merged
merged 1 commit into from
Jan 15, 2020
Merged

Fake being in GOPATH when generating code. #1253

merged 1 commit into from
Jan 15, 2020

Conversation

porridge
Copy link
Member

@porridge porridge commented Jan 8, 2020

What this PR does / why we need it:

This is a workaround for the code generators requiring $GOPATH to put output in the correct location.
Details in the issue.

Fixes #1252

@ANeumann82
Copy link
Member

I ran into the same issue (currently working on multiple api version, and conversion-gen, etc).
I've solved it with something like this:

if [[ -d ${CODE_GEN_DIR} ]]; then
    echo "Using cached code generator version: $VERSION"
else
    git clone https://github.com/kubernetes/code-generator.git "${CODE_GEN_DIR}"
    git -C "${CODE_GEN_DIR}" reset --hard "${VERSION}"
    (
        cd "${CODE_GEN_DIR}"
        # Make sure code-gen uses the local kudo codebase, and not a remote module
        go mod edit -replace=github.com/kudobuilder/kudo=../../../
    )
fi

in the update_code_gen.sh.

This looks a bit easier than faking the gopath, but maybe I have overlooked something?

@ANeumann82
Copy link
Member

Mmmmm, this might fix a different issue than the one I mentioned in my previous comment. In my case the issue was that the codegens used a go module of kudo to analyze the code and generate stuff.

@porridge porridge merged commit ef36da2 into master Jan 15, 2020
@porridge porridge deleted the fake-gopath branch January 15, 2020 14:01
ANeumann82 pushed a commit that referenced this pull request Feb 13, 2020
What this PR does / why we need it:

This is a workaround for the code generators requiring $GOPATH to put output in the correct location.
Details in the issue.

Fixes #1252

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make generate puts files under wrong path
3 participants