-
Notifications
You must be signed in to change notification settings - Fork 646
go build -o
should be using -i
#673
Comments
Is there any official documentation for this? |
https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies
The -i flag installs the packages that are dependencies of the target.
Unfortunately I am not aware of documentation explaining the ramifications
of having packages installed.
Here is a Quora explaination:
https://www.quora.com/What-is-the-difference-between-build-and-install-in-Go
Basically what I saw is that when using -i in build or test, the dependency
packages are cached and reused if they haven't changed. You can test that
using an expensive pack to build such as sqlite3.
Once you build it once with -i, other builds can use the cache.
…On Thu, Dec 15, 2016, 18:37 Ramya Rao ***@***.***> wrote:
@mattetti <https://github.com/mattetti>
My understanding is that installed packages aren't rebuilt.
Is there any official documentation for this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#673 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAAcc16nX5skf1Zy71OCq8JAHwAd-1Vks5rIflUgaJpZM4LBHQH>
.
|
@derekperkins mentioned https://github.com/joshuarubin/zb in another issue. This claims to run faster builds. It comes down to build vs install there as well |
I don't know if we should go all the way to pushing something like zb but
yes zb uses some of the same techniques. -i really shouldn't have any down
sides, besides making for faster builds, especially on save.
…On Thu, Dec 15, 2016, 19:08 Ramya Rao ***@***.***> wrote:
@derekperkins <https://github.com/derekperkins> mentioned
https://github.com/joshuarubin/zb in another issue. This claims to run
faster builds. It comes down to build vs install there as well
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#673 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAAcSP9mLKu3ISNySbO7eTukSPi1Vnmks5rIgCmgaJpZM4LBHQH>
.
|
I'll look at adding this flag and send a PR, @ramya-rao-a would you mind allocating this issue to me? |
Done |
I was doing some reading up on If there is such a flag, then it doesnt make sense that I'd prefer to see some documentation on why |
@ramya-rao-a indeed the
I could add a setting to not use As you are reading more about go build, I wonder if you can find for downsides of using Oh, and before you ask, I think the reason why the go team didn't setup go build to use -i automatically is probably because they didn't want to bother looking up the package being built, but that's just a guess. |
Note that the hope if that the PR is merged, the problem reported here and in #686 should be addressed. I did some investigation, Go/tool:
I looked at the difference between
But in the
And then the compiled dependency is pushed there (wav pkg archive):
I didn't dig much further but my limited understanding is that archive file is to be used next time instead of being recompiled. I'm sure Go does some extra check to make sure it hasn't changed but that's the gist of it. |
Here are some interesting threads talking about go install/go build -i: https://www.reddit.com/r/golang/comments/2qpzm8/question_on_go_build_i_and_rebuilding_a_library/ This is a project that says can make your compilation 7x faster. It's really only a wrapper around go install: https://github.com/kovetskiy/go-fast This is an interesting discussion about Dave puts it simply:
However, his suggestion is to just use |
It doesn't look like there is a difference between go build -i and go install: |
We should invite Dave to this discussion :) |
@davecheney do you have a recommendation for us? Q1: is there a downside to installing non main packages ? (As in should we offer a way to turn that off) |
Another note: The main intention of running |
My opinion is use go install.
Dominic or Damian would be better people to ask about tool recommendations.
…On Thu, 12 Jan 2017, 18:28 Matt Aimonetti ***@***.***> wrote:
@davecheney <https://github.com/davecheney> do you have a recommendation
for us?
VsCode has a feature to optionally auto build the package you are editing.
I was suggesting to add the -i flag to cache dependencies.
Q1: is there a downside to installing non main packages ? (As in should we
offer a way to turn that off)
Q2: is go install a better approach?
Q3: any other recommendations to make actions at save time faster (go
build, vet, lint...)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#673 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcAz_u3LgbkFuGTOv_l-hE7mu6xMciks5rRdY1gaJpZM4LBHQH>
.
|
In the scope of one run, neither is faster. In the scope of subsequent builds, the latter will be faster.
… On 12 Jan 2017, at 18:32, Ramya Rao ***@***.***> wrote:
Another note: The main intention of running go build at every save, is to show compiler errors if any.
What is being debated here is that when dependent packages have not changed, which is faster go build -o or go build -i
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Just to confirm/clarify: I did that. If I understand this ticket correctly then the go extension will also trigger a full compile on saving? In my case though this isn't that expensive because most of my packages are installed the moment I start the debugger for the first time? |
@ankon |
@mattetti I did some more digging and my findings match yours. PR approved and merged :) |
@mattetti More on exactly what you have been saying: Below is from https://twitter.com/MorganGeek/status/821981043527974914
|
The latest update (0.6.53) has this change. Thanks @mattetti |
Wondering if it's worth resurrecting this. Often you do work on a main package, and if you do, compilation accidentally becomes much slower because This behaviour wasn't clear to me, and so I didn't understand why my builds were getting super slow. I work on a tool that pulls in the Kubernetes client, which is huge and takes a long time (10-20 seconds with something like 4 parallel processes) to compile, and this is executed on every save. (At one point my entire machine stalled because a thundering herd of 20-30 Why can't |
As discussed here: #1013 (comment) Yes, we can use We always use Fixed with 2f398ae |
Awesome. Any reason it's writing to a file and not |
Must be. That was before my time. |
I noticed that we rebuild all packages every time a user saves a project with build on save on. I think it would be best to use the
-i
flag to only build packages that changed.My understanding is that installed packages aren't rebuilt. I can see that building a project with a slow to build dependency such as
github.com/mattn/go-sqlite3
is much much faster when the project is built with-i
.@ramya-rao-a what do you think?
The text was updated successfully, but these errors were encountered: