Skip to content

Add tool dependencies to go.mod#230

Merged
andrewkroh merged 1 commit intoelastic:masterfrom
andrewkroh:go-mod-tools
Jan 21, 2021
Merged

Add tool dependencies to go.mod#230
andrewkroh merged 1 commit intoelastic:masterfrom
andrewkroh:go-mod-tools

Conversation

@andrewkroh
Copy link
Copy Markdown
Member

Changes in tools and their dependencies can cause previously passing
builds to start failing because of 'make check'. This adds the project's tool
dependencies to go.mod so this no longer happens. An alternative would
be invoke use GO111MODULE=off go get when fetching tool dependencies
in the Makefile since this would not modify go.mod.

The root of the problem is the Makefile calls go get -u which adds the tool
dependency to go.mod AND updates any transitive dependencies of the tool.
Then go mod tidy is executed which removes the entries from go.mod but
leaves behind the go.sum updates to the transitive dependencies that the
project uses. Since go.sum is modified make check fails.

Reference: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module

@andrewkroh
Copy link
Copy Markdown
Member Author

This is intended to fix the failing build of master. Like https://beats-ci.elastic.co/job/Ingest-manager/job/elastic-package/job/master/16/.

@elasticmachine
Copy link
Copy Markdown
Collaborator

elasticmachine commented Jan 20, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #230 updated

    • Start Time: 2021-01-20T20:04:29.136+0000
  • Duration: 11 min 17 sec

  • Commit: 49a661c

Test stats 🧪

Test Results
Failed 0
Passed 290
Skipped 0
Total 290

Changes in tools and their dependencies can cause previously passing
builds to start failing because of 'make check'. This adds the project's tool
dependencies to go.mod so this no longer happens. An alternative would
be invoke use `GO111MODULE=off go get` when fetching tool dependencies
in the Makefile since this would not modify go.mod.

The root of the problem is the Makefile calls `go get -u` which adds the tool
dependency to go.mod AND updates any transitive dependencies of the tool.
Then `go mod tidy` is executed which removes the entries from go.mod but
leaves behind the go.sum updates to the transitive dependencies that the
project uses. Since go.sum is modified `make check` fails.

Reference: https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
@andrewkroh andrewkroh merged commit 8eaff61 into elastic:master Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants