Skip to content
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

Remove GO111MODULE=off from :GoInstallBinaries as it's not necessary anymore #2979

Closed
maruel opened this issue Aug 15, 2020 · 3 comments
Closed
Labels

Comments

@maruel
Copy link

maruel commented Aug 15, 2020

Last year, some tools installed by :GoInstallBinaries were not compatible with GO111MODULE=on. This was tracked as issue #2248.
Commit 1237fa0 (later tweaked with commit 4899a0e) fixed it by enforcing GO111MODULE=off during the installation.

While this was necessary, that has the drawback of polluting the user's GOPATH.

A year later, I did a manual test just now and found that this is not necessary anymore!

export GO111MODULE=on
go get github.com/klauspost/asmfmt/cmd/asmfmt
go get github.com/go-delve/delve/cmd/dlv
go get github.com/kisielk/errcheck
go get github.com/davidrjenni/reftools/cmd/fillstruct
go get github.com/rogpeppe/godef
go get golang.org/x/tools/cmd/goimports
go get golang.org/x/lint/golint
go get golang.org/x/tools/gopls
go get github.com/golangci/golangci-lint/cmd/golangci-lint
go get github.com/fatih/gomodifytags
go get golang.org/x/tools/cmd/gorename
go get github.com/jstemmer/gotags
go get golang.org/x/tools/cmd/guru
go get github.com/josharian/impl
go get honnef.co/go/tools/cmd/keyify
go get github.com/fatih/motion
go get github.com/koron/iferr

This succeeded.

As such, I'd request to remove this hack. In practice, it's removing references to Restore_modules in plugin/go.vim so it should be a simple change. Filing a formal bug to confirm such change would be accepted.

@bhcleek
Copy link
Collaborator

bhcleek commented Aug 15, 2020

Thanks for filing a bug. Unfortunately, not all of the tools support Go modules. I see at least three that do not:

  • github.com/koron/iferr
  • github.com/klauspost/asmfmt/cmd/asmfmt
  • github.com/jstemmer/gotags

However, if you want to submit a patch that uses modules by appending @latest to their list entries, I'd gladly accept that.

I'd also accept a patch that uses a temporary GOPATH for installing those that aren't modules so that the user's GOPATH isn't polluted.

@bhcleek
Copy link
Collaborator

bhcleek commented Aug 16, 2020

It's also worth pointing out that GO111MODULE must still be set in order to set it appropriately regardless of what the user has it configured as to make sure the right thing is done. The relevant section in the go's help is worth considering to give you more context: https://golang.org/cmd/go/#hdr-Module_support

@bhcleek bhcleek added the invalid label Oct 9, 2020
@bhcleek
Copy link
Collaborator

bhcleek commented Oct 9, 2020

Although some of the binaries are not modules, Go can still handle that situation without polluting GOPATH. Vim-go has taken advantage of that for since last year. Although vim-go changes into a temporary directory, it's not used, though there is one possible future case where using GO111MODULE=off may be useful again, so I'm going to leave the code in for now even though it's not used at the moment.

@bhcleek bhcleek closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants