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

Integration tests for go module support #171

Closed
Cynocracy opened this issue Jun 1, 2020 · 8 comments
Closed

Integration tests for go module support #171

Cynocracy opened this issue Jun 1, 2020 · 8 comments
Assignees

Comments

@Cynocracy
Copy link
Contributor

ko, when run from within the GOPATH, uses GOPATH mode for resolving images even when environment variables instruct otherwise.

ko version 0.5.1

@Cynocracy
Copy link
Contributor Author

One caveat here: I have 2 machines with this setup and they're behaving differently :( One seems to do fine with the module type ko:// references to vendor. The other does not. I'll have to take a look and see if ko has debugging tips anywhere, I'd love to figure out this mystery :)

@Cynocracy
Copy link
Contributor Author

Thoughts on changing to using https://golang.org/pkg/go/build/ from exec to see if that helps resolve inconsistencies?

@Cynocracy
Copy link
Contributor Author

In slack I got a "sure, why not?" So I'm going to play around with that.

/assign Cynocracy

@Cynocracy
Copy link
Contributor Author

No luck, but please consider it assigned.

@Cynocracy
Copy link
Contributor Author

This /may/ have been due to a bug in our setup, but we're investigating a bit more now that we got our internal repo into a good state. That should help us understand a bit better why this is occurring (and play around with fixes :)

@Cynocracy
Copy link
Contributor Author

OK, here's my attempt at repro.

Setup

  1. Add a tools.go file to ko's root, and import 'github.com/go-training/helloworld'
  2. go mod vendor && go mod tidy
  3. Modify vendor to change message output
  4. Make sure you are in the GOPATH (where you might fallback to GOPATH mode) and you run go get -d github.com/go-training/helloworld`

Scenarios:
a. GO111MODULE=on GOFLAGS="-mod=vendor" should always output the changed text
b. GO111MODULE=auto GOFLAGS="-mod=vendor" should output the changed text iff in the module path, otherwise the original text.
i. In the module root
ii. Outside module root
c. GO111MODULE=off should output the original text.
d. GO111MODULE=on should fail outside a module.

Results:
a. GO111MODULE="on" GOFLAGS="-mod=vendor" ko publish github.com/go-training/helloworld

docker run result
Hello World TEST!!

b.
i.
Hello World TEST!!

ii.
Hello World!!

c.
Hello World!!

d.
go: cannot find main module; see 'go help modules'

So: WAI 👍 Most likely the issues I was seeing were related to our own infra around ko and not ko itself.

Any objections to me adding something similar as an integration test?

@Cynocracy Cynocracy changed the title ko does not respect GO111MODULE=on and GOFLAGS=-mod=vendor Integration tests for go module support Jul 27, 2020
@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

@jonjohnsonjr
Copy link
Collaborator

Fixed by #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants