Skip to content

Fix bug in gotestsum installer causing dependencies to not be downloaded#40979

Merged
tiborvass merged 2 commits intomoby:masterfrom
thaJeztah:fix_gotestsum_install
May 17, 2020
Merged

Fix bug in gotestsum installer causing dependencies to not be downloaded#40979
tiborvass merged 2 commits intomoby:masterfrom
thaJeztah:fix_gotestsum_install

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

Building gotestsum started to fail after the repository removed some
dependencies on master.

What happens is that first, we go get the package (with go modules disabled);

GO111MODULE=off go get -d gotest.tools/gotestsum

Which gets the latest version from master, and fetches the dependencies used
on master. Then we checkout the version we want to install (for example v0.3.5)
and run go build.

However, v0.3.5 depends on logrus, and given that we ran go get for master,
that dependency was not fetched, and build fails.

This patch modifies the installer to use go modules (alternatively we could
probably run go get . after checking out the v0.3.5 version),

We need to modify all installers, as it looks like this is a standard pattern
we use, but other dependencies were not failing (yet), so this patch only
addresses the immediate failure.

@thaJeztah
Copy link
Copy Markdown
Member Author

ping @AkihiroSuda @cpuguy83 @tiborvass PTAL this fixes the build-failures seen in #40977

@thaJeztah
Copy link
Copy Markdown
Member Author

dang; probably need to fix the Windows build as well. PowerShell here I come 😞

@thaJeztah thaJeztah force-pushed the fix_gotestsum_install branch from 2764638 to 7beaca1 Compare May 16, 2020 16:43
@thaJeztah thaJeztah mentioned this pull request May 16, 2020
Building gotestsum started to fail after the repository removed some
dependencies on master.

What happens is that first, we `go get` the package (with go modules disabled);

    GO111MODULE=off go get -d gotest.tools/gotestsum

Which gets the latest version from master, and fetches the dependencies used
on master. Then we checkout the version we want to install (for example `v0.3.5`)
and run go build.

However, `v0.3.5` depends on logrus, and given that we ran `go get` for `master`,
that dependency was not fetched, and build fails.

This patch modifies the installer to use go modules (alternatively we could
probably run `go get .` after checking out the `v0.3.5` version),

We need to modify all installers, as it looks like this is a standard pattern
we use, but other dependencies were not failing (yet), so this patch only
addresses the immediate failure.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the fix_gotestsum_install branch 3 times, most recently from ae4ff23 to e65ca18 Compare May 16, 2020 17:16
@thaJeztah
Copy link
Copy Markdown
Member Author

argh PowerShell, why u so verbose ? 😞

@thaJeztah thaJeztah force-pushed the fix_gotestsum_install branch 2 times, most recently from 9dfd42d to 07b6821 Compare May 16, 2020 17:57
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the fix_gotestsum_install branch from 07b6821 to aadc55c Compare May 16, 2020 18:12
if ($savedExitCode -ne 0) { `
$env:GO111MODULE = 'on'; `
&go get -d "gotest.tools/gotestsum@${Env:GOTESTSUM_COMMIT}"; `
$env:GO111MODULE = 'off'; `
Copy link
Copy Markdown
Contributor

@tiborvass tiborvass May 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go after LASTEXITCODE, in case resetting the envvar modifies LASTEXITCODE.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, probably need to add an intermediate variable again 😞

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure actually; can $env:FOO = something fail?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's not needed;

PS> go get -d example.com/foobar
unrecognized import path "example.com/foobar": reading https://example.com/foobar?go-get=1: 404 Not Found
PS> echo $LASTEXITCODE
1
PS> $env:GO111MODULE = 'off';
PS> echo $LASTEXITCODE
1

@thaJeztah
Copy link
Copy Markdown
Member Author

@tiborvass all green now; PTAL

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.

2 participants