Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Reconsider default of go.installDependenciesWhenBuilding #2836

Closed
segevfiner opened this issue Oct 16, 2019 · 8 comments
Closed

Reconsider default of go.installDependenciesWhenBuilding #2836

segevfiner opened this issue Oct 16, 2019 · 8 comments

Comments

@segevfiner
Copy link
Contributor

Do any Go tools we use still depend on installed packages, that is go build -i? If the answer is no, then as AFAIK installing dependencies is just a waste of time and space at that point and we should consider changing the default of go.installDependenciesWhenBuilding to false.

I think it's a mechanism left for backwards compatibility for stuff that depended on it, from the Go 1.10 release notes:

Installing dependency packages should not be necessary in general, and the very concept of installed packages may disappear in a future release.

https://golang.org/doc/go1.10#build

@ramya-rao-a
Copy link
Contributor

I am not an expert on the go build command and would like to loop in a few more people into this discussion.

Looping in @mattetti who made the initial PR #718 to add the -i flag to the go build command
Looping in @ardan-bkennedy who I know via #1064 uses the -i flag
Looping in @stamblerre who I hope can loop in someone working on the go command itself

@mattetti
Copy link
Contributor

The old advice to add the -i flag for speed, as in go build -i or go test -i, is no longer necessary: builds run just as fast without -i. For more details, see go help cache.

It's quite clear that this flag isn't needed and might indeed slow things down. Thanks @segevfiner

@stamblerre
Copy link
Contributor

/cc @jayconrod as the go command expert, but it sounds to me like building without -i sounds like the correct approach, particularly now that we have modules

@jayconrod
Copy link

Assuming nothing actually depends on .a files being installed into $GOPATH/pkg, I don't think this flag is necessary anymore.

In GOPATH mode, there may be some performance cost to using -i, since it will be copying .a files out of the cache into $GOPATH/pkg.

In module mode, I don't think -i has any effect, since we don't install .a files.

@ramya-rao-a
Copy link
Contributor

So, we are leaning towards not using -i regardless of whether one is using modules or not, correct?

@segevfiner
Copy link
Contributor Author

Seems like it...? I think the only thing we need to make sure is that we don't use some tool that otherwise depends on $GOPATH/pkg and didn't learn to rely on the Go build cache instead.

@segevfiner
Copy link
Contributor Author

Looks like github.com/mdempsky/gocode (non-modules) still relies on "go/pkg" installed packages as it doesn't show any completion for me when I disable go.installDependenciesWhenBuilding.

@ramya-rao-a
Copy link
Contributor

Thanks @segevfiner

People not using modules or the language server still end up using github.com/mdempsky/gocode, so we will keep this default value as is for now.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants