-
Notifications
You must be signed in to change notification settings - Fork 591
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
Fixes Dockerfile based examples to run from correct directory #767
Conversation
With go-1.16, `go install` no longer modifies `go.mod` files to correct omissions of required module imports. This means all `go.mod` files must provide a complete and correct set of `requires` module imports. While the `go.mod` files inside the `examples` directories does include the correct requires, some of the `Dockerfile` examples run a `go install` command from the corresponding instrumentation directory (one level above the examples directory). This means `go install` was looking at the `go.mod` file at the instrumentation directory level, not the `go.mod` file included in the `examples/` directory. This changes all such cases to set the working directory to the `example` directory containing the correct `go.mod` before running `go install`.
This fixes #623. However it also indicates we may want to include checking that the I've opened an issue #768 to track this |
Co-authored-by: Anthony Mirabella <[email protected]>
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.
Should this include upgrading the base image to 1.16, or have I missed something?
It could, but I thought this could be done in a separate PR. For example, in In this case, the issue is that two examples were pulling from `golang:alpine" rather than a specific version of golang These were the only ones failing, but I took the opportunity to fix all the examples which were incorrectly trying to run In other words, this PR just fixes the previously incorrect behavior - which means they now work with any version of go. What do you think about creating a separate issue to go through and standardize the Dockerfile based images to all be a consistent version of |
With go-1.16,
go install
no longer modifiesgo.mod
files to correct omissions of required module imports. This means allgo.mod
files must provide a complete and correct set ofrequires
module imports.While the
go.mod
files inside theexamples
directories do include the correct requires, some of theDockerfile
examples run ago install
command from the corresponding instrumentation directory (one level above the examples directory). This meansgo install
looks at thego.mod
file at the instrumentation directory level instead of thego.mod
file included in theexamples/
directory.This changes all such cases to set the working directory to the
example
directory containing the correctgo.mod
before runninggo install
.