Skip to content

Conversation

@thaJeztah
Copy link
Member

When using go modules, go build will always fetch the latest
version of the package, so ignores the version we previously go get'd.

Instead of running go get and go build separately, this patch uses
go get (without the -d option) to do it all in one step.

Given that this binary is only used for testing, and only used inside the
Dockerfile, we should consider inlining this step in the Dockerfile itself,
but keeping that separate for now.

@thaJeztah
Copy link
Member Author

@SamWhited @AkihiroSuda @cpuguy83 PTAL

@thaJeztah thaJeztah mentioned this pull request Jun 24, 2020
20 tasks
Copy link
Contributor

@SamWhited SamWhited left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member Author

Argh. Windows script also has the same problem

cannot find module providing package gotest.tools/gotestsum: working directory is not part of a module
gotestsum build failed...
At line:1 char:533
+ ...  if ($LASTEXITCODE -ne 0) { Throw 'gotestsum build failed...'; } Writ ...
+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (gotestsum build failed...:Str 
   ing) [], RuntimeException
    + FullyQualifiedErrorId : gotestsum build failed...
 



ERROR: Failed 'ERROR: Failed to build image from Dockerfile.windows' at 06/24/2020 15:28:34
At D:\gopath\src\github.com\docker\docker\hack\ci\windows.ps1:483 char:12
+            Throw "ERROR: Failed to build image from Dockerfile.window ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let me push another commit to fix that one (keeping it in a separate commit as 19.03 does not yet have that part, so easier to backport then)

@thaJeztah thaJeztah force-pushed the fix_gotestsum_install_again branch 4 times, most recently from 1ddeaa3 to 610f1b2 Compare June 25, 2020 08:20
@thaJeztah
Copy link
Member Author

CI is failing on a flaky test; #41138

@thaJeztah
Copy link
Member Author

All green now 👍

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this one need -ldflags to set main.version too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes, perhaps we should add it there (we didn't do that before, it was mostly when I tried checking if it's the right version)

Copy link
Member Author

Choose a reason for hiding this comment

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

or perhaps I should remove it from the other one, as we don't really use it 🤔

let me know if you feel strongly about one or the other

Copy link
Member

Choose a reason for hiding this comment

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

I don't really feel strongly either way -- just that we should try to keep them consistent. 😅

I'm personally fine with this binary not knowing what version it is, but I don't run it very often, so I think I'm the wrong one to opine. 🤷 ❤️

Copy link
Member

Choose a reason for hiding this comment

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

Agree, let's just be consistent.

When using go modules, `go build` will always fetch the latest
version of the package, so ignores the version we previously `go get`'d.

Instead of running `go get` and `go build` separately, this patch uses
`go get` (without the `-d` option) to do it all in one step.

Given that this binary is only used for testing, and only used inside the
Dockerfile, we should consider inlining this step in the Dockerfile itself,
but keeping that separate for now.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
When using go modules, `go build` will always fetch the latest
version of the package, so ignores the version we previously `go get`'d.

Instead of running `go get` and `go build` separately, this patch uses
`go get` (without the `-d` option) to do it all in one step.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
No need for this binary as it's only used in tests.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah force-pushed the fix_gotestsum_install_again branch from 610f1b2 to a9d22ca Compare June 26, 2020 14:58
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member Author

Thanks @tianon

@cpuguy83 PTAL: I removed the ldflags, and also added a commit to remove $GO_BUILDMODE, as I don't think we need --buildmode=pie for this binary (likely not for others as well, but didn't look yet)

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants