-
Notifications
You must be signed in to change notification settings - Fork 195
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
Update gengo to use go mod. #178
Conversation
Signed-off-by: Scott Nichols <[email protected]>
Welcome @n3wscott! |
/retest not sure how to get travis to run again. |
@n3wscott: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Scott Nichols <[email protected]>
Looks ready for test (if there are prow tests), travis passed now. |
hack/update-deps.sh
Outdated
@@ -0,0 +1,23 @@ | |||
#!/usr/bin/env bash |
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.
I'd love to keep this repo 100% shell-free :/
Is there any alternative to adding this? @liggitt might have an idea?
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.
I like the approach of super-minimal makefiles (e.g. one-line target definitions, no external file includes) that just call go commands, e.g.:
make test == go test ./…
make deps == go mod tidy && go mod vendor
It technically is still shell-adjacent, but with those two rules it tends to be less of a dumping ground for crazy stuff.
Also, is it necessary to vendor?
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.
Not needed to vendor but I think it was originally, I can double check.
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.
a fake vendor directory does not work in go 1.14, it confuses go mod to only look in vendor and not the cache. I moved the fake package to testdata.
That still seems like it shouldn't be necessary. I'd expect test data to be completely isolated from the dependencies of the module. See https://github.com/kubernetes-sigs/clientgofix/blob/v0.3.0/pkg/fix_test.go#L38-L42 for an example of exercising various $GOPATH/module vendor/no-vendor scenarios in test cases |
but the point of this test is that there is a package that is out of tree that the test is solving for, so go mod needs to know where to look. Previously it looked in vendor as that is a magic extension of $GOPATH, but that option is not available for go 1.14 as the existence of a vendor dir will limit the $GOPATH to only |
Here is the test that uses the package gengo/parser/local_parse_test.go Line 25 in e0e292d
go mod also does not see this as an import because package Without the replace line, the test fails:
This is expected because of the vendor gotchyas with go 1.14 |
Ping on this. RFAL |
I'm OK with this. Jordan, any more thoughts? |
I really don't want fake test modules or dependencies expressed in the go.mod file downstreams of this repo will be consuming. I added a commit to https://github.com/liggitt/kubernetes-gengo/commits/move-go-mod which lets us run this test scenario without a replace in the actual go.mod |
Yeah, that looks better.
…On Tue, May 12, 2020 at 2:06 PM Jordan Liggitt ***@***.***> wrote:
I really don't want fake test modules or dependencies expressed in the
go.mod file. I added a commit to
https://github.com/liggitt/kubernetes-gengo/commits/move-go-mod which
lets us run this test scenario without a replace in the actual go.mod
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#178 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE6BFXFIZE4UCI7KVTU7G3RRG25JANCNFSM4MZ4UCEQ>
.
|
Move go mod
ok thanks @liggitt I merged your update into this PR to drop the replace. |
/lgtm Thanks!! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lavalamp, n3wscott The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
As a replacement for lavalamp#1 and #144.
Fixes #143
The move to go 1.13 seems to have solved the previous issues found in go mod 1.12.
Signed-off-by: Scott Nichols [email protected]