-
Notifications
You must be signed in to change notification settings - Fork 7
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
add empty go.mod to avoid go mod problems #1038
Conversation
b445def
to
75ed368
Compare
Pull Request Test Coverage Report for Build 7031
💛 - Coveralls |
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 feels a little like a hack, right? Is there a way to remove those files instead? IIRC files like that were also causing issues for App Engine builds at one time. It's an anti-pattern to allow.
Reviewable status: 0 of 1 approvals obtained
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.
IIUC, those are filenames within actual web100 and pt archives. I checked, and there are two tar.gz files in the testdata, and they both contain filenames with colons.
I believe that it is actually correct to ignore tests altogether in go mod. So I'm inclined to think we should add empty go.mod files to all testdata directories.
I guess you could consider it a hack that I develop on Darwin, but it is a terrific convenience, and I think it is worth enabling.
Reviewable status: 0 of 1 approvals obtained
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.
Yes, I think I'm the one that created those tgz files b/c they used to be just plain files but the colons were causing trouble in App Engine. I've not seen the "empty go mod" pattern before. Something doesn't feel right.
Are these new files? Or, files that are not being cleaned up by https://github.com/m-lab/etl/blob/master/parser/parser_test.go#L218 ? Why aren't they being cleaned up? If our unit tests are doing something that is making our workflow harder, I think the solution is to fix the unit tests, e.g. unpack the files in a system /tmp directory or other out-of-bounds location. Do I have the full story?
Reviewable status: 0 of 1 approvals obtained
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 think go mod is now looking at the contents of the tar.gz files. Don't know why. I think this hasn't shown up before because we weren't using go mod, and when we started using go mod, I didn't try building on Darwin until today.
Looks like it hasn't made it into official documentation. There is this open issue: golang/go#31137
Reviewable status: 0 of 1 approvals obtained
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 trouble starts for me when I try to run tests for gardener on Darwin...
go test ./job-service/...
go: cannot find main module, but found .git/config in /Users/gfr/go/src/github.com/m-lab/etl-gardener
to create a module there, run:
go mod init
Not sure why it wants me to run go mod, but when I do, I run into the issues with etl/parser/testdata. I guess if we can solve the "cannot find main module" problem, we can sidestep this for now, but it still seems to me like the empty go.mod file is an appropriate longterm solution.
Reviewable status: 0 of 1 approvals obtained
Ok - my local problem was triggered by upgrading (some months ago) to go116. This version defaults GO111MODULE to "on" instead of "auto", so that triggered complaints that there was no main module, and one should run go mod init etc. There is a single dependency in etl-gardener on etl/etl/globals.go, so go mod tidy includes etl. So, this might be the fun bit. The tests include these lines: UPSHOT:
|
Closing to clean up old PRs. For point 2 - #1083 |
When building etl-gardener on darwin, go mod fails because of colons in paths in etl/parser/testdata. This allows go mod to ignore that directory.
This change is