8000 Add go build option '-i' only for native builds by schomatis · Pull Request #1937 · containerd/containerd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add go build option '-i' only for native builds #1937

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

Merged
merged 1 commit into from
Dec 21, 2017
Merged

Add go build option '-i' only for native builds #1937

merged 1 commit into from
Dec 21, 2017

Conversation

schomatis
Copy link

This PR adds the go build option -i that installs the packages that are dependencies of the target (to speed up future builds).

This was removed in #1179 because it caused problems when cross-compiling, when the install was being done on the incorrect (not native) path (this comment gives a clear example).

The GOHOSTOS environment variable was added to the Makefile to detect when the build was being done against the native platform, and only then add the -i option.

Also the GO_BUILD_FLAGS variable was added to encapsulate this option (and possible future ones), instead of just hard coding it into the go build command. According to the go build documentation the -i option is not exactly a build flag (it's listed separately) but for the purposes of this PR it can be considered as such.

As noted in this comment this option won't be needed in Go 1.10.

Some simple commands to test the modification:

GOOS=linux make -pn | grep "go build"
GOOS=windows make -pn | grep "go build"
GOOS=windows GOHOSTOS=linux make -pn | grep "go build"
GOOS=windows GOHOSTOS=windows make -pn | grep "go build"

Closes #1905.

Signed-off-by: Lucas Molas <lmolas@fundacionsadosky.org.ar>
@codecov-io
Copy link
codecov-io commented Dec 20, 2017

Codecov Report

Merging #1937 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1937   +/-   ##
=======================================
  Coverage   47.33%   47.33%           
=======================================
  Files          91       91           
  Lines        8964     8964           
=======================================
  Hits         4243     4243           
  Misses       4022     4022           
  Partials      699      699
Flag Coverage Δ
#linux 50.65% <ø> (ø) ⬆️
#windows 42.17% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd05dec...55b5e35. Read the comment docs.

@schomatis schomatis changed the title [WIP] Add go build option '-i' only for native builds Add go build option '-i' only for native builds Dec 20, 2017
@schomatis
Copy link
Author

@stevvooe PTAL

@crosbymichael
Copy link
Member

LGTM

Lets make sure we remove this after go 1.10

Copy link
Member
@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp
Copy link
Member
estesp commented Dec 21, 2017

Added #1938 as a reminder for post-go 1.10 upgrade.

@estesp estesp merged commit 3affaff into containerd:master Dec 21, 2017
@schomatis schomatis deleted the add-native-build-i-option branch December 21, 2017 04:53
@estesp estesp mentioned this pull request Jan 4, 2018
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.

4 participants
0