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

Fix gogradle plugin to stop using vendor directory #1118

Merged
merged 5 commits into from
Feb 19, 2021

Conversation

mrutkows
Copy link
Contributor

@mrutkows mrutkows commented Feb 18, 2021

ideally, I would love to replace the gogradle plugin (no sig. updates since 2017) with something more aware of the post go 1.11 moduling system and supports cross platform/arch builds simply. However, we need a means to prevent gogradle from using a "/vendor" directory and attempting to fetch its own packages/versions.

@mrutkows
Copy link
Contributor Author

mrutkows commented Feb 18, 2021

My assumption is that the gogradle plugin forces you to use a "/vendor" directory and we really do not want one at all; however, the "go" command assumes that if it sees a "/vendor" directory that it overrides "go.mod". So we need to either:

a) prevent gogradle from installing anything into "/vendor" meaning we need to prevent the Task :resolveBuildDependencies and Task :installDependencies from installing packages into "/vendor" or
or
b) we set the new flag option on the "go" command i.e., -mod=mod to force it to ignore the vendor directory regardless of what gogradle does.

See: https://tip.golang.org/doc/go1.14 for a desc. of this behavior

This blog explains it better and has a demo of switching between go 1.13 and go 1.14: https://www.ardanlabs.com/blog/2020/04/modules-06-vendoring.html

@mrutkows
Copy link
Contributor Author

I should mention that a 3rd option exists, but I discounted it since it basically capitulates to the old gogradle plugin (and also bypasses it for managing deps.) and uses the "go" command to create the vendor directory i.e., go mod vendor: https://www.honeybadger.io/blog/golang-go-package-management/

@mrutkows
Copy link
Contributor Author

ideally, we switch to a more current gradle plugin such as: https://github.com/innobead/gogradle which works better with go.mod and is more straightforward or eliminate gradle altogether and find a better way to switch OS/ARCH for docker builds.

@mrutkows mrutkows marked this pull request as ready for review February 19, 2021 22:38
Copy link
Member

@pritidesai pritidesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @mrutkows for the detailed explanation, hope this fixes the build 🤞

@pritidesai pritidesai merged commit 503192d into apache:master Feb 19, 2021
@mrutkows
Copy link
Contributor Author

@pritidesai Thanks Priti!

@mrutkows mrutkows deleted the gradle branch February 23, 2021 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants