Skip to content

hack/vendor.sh: run "go mod tidy" before vendoring#43212

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:fix_vendor
Feb 5, 2022
Merged

hack/vendor.sh: run "go mod tidy" before vendoring#43212
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:fix_vendor

Conversation

@thaJeztah
Copy link
Member

relates to:

The hack/vendor.sh script is used to (re)vendor dependencies. However, it did
not run go mod tidy before doing so, wheras the vendor validation script
did.

This could result in vendor validation failing if go mod tidy resulted in
changes (which could be in vendor.sum).

In "usual" situations, this could be easily done by the user (go mod tidy
before running go mod vendor), but due to our (curent) uses of vendor.mod,
and having to first set up a (dummy) go.mod, this is more complicated.

Instead, just make the script do this, so that hack/vendor.sh will always
produce the expected result.

Signed-off-by: Sebastiaan van Stijn github@gone.nl

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

The hack/vendor.sh script is used to (re)vendor dependencies. However, it did
not run `go mod tidy` before doing so, wheras the vendor _validation_ script
did.

This could result in vendor validation failing if go mod tidy resulted in
changes (which could be in `vendor.sum`).

In "usual" situations, this could be easily done by the user (`go mod tidy`
before running `go mod vendor`), but due to our (curent) uses of `vendor.mod`,
and having to first set up a (dummy) `go.mod`, this is more complicated.

Instead, just make the script do this, so that `hack/vendor.sh` will always
produce the expected result.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Member Author

@crazy-max @tianon @AkihiroSuda PTAL

@thaJeztah thaJeztah mentioned this pull request Feb 5, 2022
@thaJeztah
Copy link
Member Author

let's get this one in 👍

@thaJeztah thaJeztah merged commit 36313c4 into moby:master Feb 5, 2022
@thaJeztah thaJeztah deleted the fix_vendor branch February 5, 2022 18:55
@thaJeztah thaJeztah added this to the 22.06.0 milestone Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants