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

Some binaries require GOPATH mode to be installed #2248

Closed
drewthor opened this issue Apr 27, 2019 · 13 comments · Fixed by #2253
Closed

Some binaries require GOPATH mode to be installed #2248

drewthor opened this issue Apr 27, 2019 · 13 comments · Fixed by #2253

Comments

@drewthor
Copy link

What did you do? (required. The issue will be closed when not provided.)

:GoInstallBinaries

What did you expect to happen?

Install vim-go properly

What happened instead?

vim-go is not installed

Configuration (MUST fill this out):

  • vim-go version:
    I cannot get this as vim-go doesn't install. I am up-to-date (as of 27/04/2019) in cloned git repo of vim-go

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):
    set smartindent
    set tabstop=2
    set shiftwidth=4
    set expandtab
    set nocompatible
    set shell=/bin/sh
    syntax on
    filetype plugin on
    let g:go_disable_autoinstall = 0
    " Use a blinking upright bar cursor in Insert mode, a blinking block in normal
    if &term == 'xterm-256color' || &term == 'screen-256color'
    let &t_SI = "<Esc>[5 q"
    let &t_EI = "<Esc>[1 q"
    endif

if exists('$TMUX')
let &t_EI = "<Esc>Ptmux;<Esc><Esc>]50;CursorShape=0\x7<Esc>\"
let &t_SI = "<Esc>Ptmux;<Esc><Esc>]50;CursorShape=1\x7<Esc>\"
endif

  • Vim version (first three lines from :version):
    VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 19 2019 12:07:03)
    macOS version
    Included patches: 1-950
    Compiled by Homebrew

  • Go version (go version):
    go version go1.12 darwin/amd64

  • Go environment (go env):
    GOARCH="amd64"
    GOBIN="/Users/Andrew/go/bin"
    GOCACHE="/Users/Andrew/Library/Caches/go-build"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOOS="darwin"
    GOPATH="/Users/Andrew/go"
    GOPROXY=""
    GORACE=""
    GOROOT="/usr/local/opt/go/libexec"
    GOTMPDIR=""
    GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
    GCCGO="gccgo"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD="/dev/null"
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2h/fs20m5d15p59qn_30g437b000000gn/T/go-build304997520=/tmp/go-build -gno-record-gcc-switches -fno-common"

@drewthor
Copy link
Author

drewthor commented Apr 27, 2019

This is the error I get about gometalinter

vim-go: gometalinter not found. Installing github.com/alecthomas/gometalinter to folder /Users/Andrew/go/bin
Error installing github.com/alecthomas/gometalinter: go: finding github.com/google/shlex latest^@go: finding gopkg.in/alecthomas/kingpin.v3-unstable latest^@go: finding github.com/nicksnyder/go-i18n/i18n latest^@go: finding github.com/alecthomas/units latest^@# github.com
/alecthomas/gometalinter^@../pkg/mod/github.com/alecthomas/[email protected]+incompatible/main.go:36:94: cannot use loadConfig (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGr
oup.Flag("config", "Load JSON configuration from file.").Envar("GOMETALINTER_CONFIG").Action^@../pkg/mod/github.com/alecthomas/[email protected]+incompatible/main.go:38:100: cannot use disableAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseC
ontext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("disable", "Disable previously enabled linters.").PlaceHolder("LINTER").Short('D').Action^@../pkg/mod/github.com/alecthomas/[email protected]+incompatible/main.go:39:99: cannot use enableAc
tion (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("enable", "Enable previously disabled linters.").PlaceHolder("LINTER").Short('E').Action^@../pkg/mod/github.com/ale
cthomas/[email protected]+incompatible/main.go:40:83: cannot use cliLinterOverrides (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("linter", "Define a linter.").Plac
eHolder("NAME:COMMAND:PATTERN").Action^@../pkg/mod/github.com/alecthomas/[email protected]+incompatible/main.go:43:56: cannot use disableAllAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as type kingpin.Action in argument to
 app.cmdMixin.flagGroup.Flag("disable-all", "Disable all linters.").Action^@../pkg/mod/github.com/alecthomas/[email protected]+incompatible/main.go:44:54: cannot use enableAllAction (type func(*kingpin.Application, *kingpin.ParseElement, *kingpin.ParseContext) error) as
 type kingpin.Action in argument to app.cmdMixin.flagGroup.Flag("enable-all", "Enable all linters.").Action^@../pkg/mod/github.com/alecthomas/[email protected]+incompatible/main.go:200:12: cannot use loadDefaultConfig (type func(*kingpin.Application, *kingpin.ParseEleme
nt, *kingpin.ParseContext) error) as type kingpin.Action in argument to app.Action^@

When I run :GoUpdateBinaries I get the aforementioned issue about gometalinter and the following issue about golangci-lint

vim-go: Updating golangci-lint. Reinstalling github.com/golangci/golangci-lint/cmd/golangci-lint to folder /Users/Andrew/go/bin
Error downloading github.com/golangci/golangci-lint/cmd/golangci-lint: go: finding github.com/golangci/golangci-lint/cmd/golangci-lint latest^@go: finding github.com/golangci/golangci-lint/cmd latest^@Fetching https://gopkg.in/airbrake/gobrake.v2?go-get=1^@Fetching https:
//golang.org/x/tools?go-get=1^@Fetching https://golang.org/x/net?go-get=1^@go: finding github.com/golangci/ineffassign latest^@Fetching https://mvdan.cc/unparam?go-get=1^@go: finding github.com/golangci/go-tools latest^@Parsing meta tags from https://golang.org/x/tools?go
-get=1 (status code 200)^@get "golang.org/x/tools": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools?go-get=1^@Parsing meta tags from https://gopkg.in/airbrake/gobrake.v2?go-g
et=1 (status code 200)^@get "gopkg.in/airbrake/gobrake.v2": found meta tag get.metaImport{Prefix:"gopkg.in/airbrake/gobrake.v2", VCS:"git", RepoRoot:"https://gopkg.in/airbrake/gobrake.v2"} at https://gopkg.in/airbrake/gobrake.v2?go-get=1^@Parsing meta tags from https://go
lang.org/x/net?go-get=1 (status code 200)^@get "golang.org/x/net": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net?go-get=1^@go: finding github.com/shirou/w32 latest^@go: finding g
ithub.com/mitchellh/go-ps latest^@Fetching https://sourcegraph.com/sourcegraph/go-diff?go-get=1^@go: finding github.com/logrusorgru/aurora latest^@go: finding github.com/golangci/check latest^@Fetching https://golang.org/x/text?go-get=1^@Parsing meta tags from https://gol
ang.org/x/text?go-get=1 (status code 200)^@get "golang.org/x/text": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text?go-get=1^@Parsing meta tags from https://mvdan.cc/unparam?go-
get=1 (status code 200)^@get "mvdan.cc/unparam": found meta tag get.metaImport{Prefix:"mvdan.cc/unparam", VCS:"git", RepoRoot:"https://github.com/mvdan/unparam"} at https://mvdan.cc/unparam?go-get=1^@go: finding golang.org/x/tools latest^@Parsing meta tags from https://so
urcegraph.com/sourcegraph/go-diff?go-get=1 (status code 200)^@get "sourcegraph.com/sourcegraph/go-diff": found meta tag get.metaImport{Prefix:"sourcegraph.com/sourcegraph/go-diff", VCS:"git", RepoRoot:"https://github.com/sourcegraph/go-diff"} at https://sourcegraph.com/so
urcegraph/go-diff?go-get=1^@go: finding github.com/golangci/dupl latest^@go: finding github.com/golangci/errcheck latest^@go: finding golang.org/x/net latest^@Fetching https://sourcegraph.com/sqs/pbtypes?go-get=1^@Fetching https://golang.org/x/crypto?go-get=1^@Parsing met
a tags from https://sourcegraph.com/sqs/pbtypes?go-get=1 (status code 200)^@Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)^@get "sourcegraph.com/sqs/pbtypes": found meta tag get.metaImport{Prefix:"sourcegraph.com/sqs/pbtypes", VCS:"git", Rep
oRoot:"https://github.com/sqs/pbtypes"} at https://sourcegraph.com/sqs/pbtypes?go-get=1^@go: finding mvdan.cc/unparam latest^@get "golang.org/x/crypto": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} a
t https://golang.org/x/crypto?go-get=1^@go: finding github.com/golangci/go-misc latest^@Fetching https://golang.org/x/sys?go-get=1^@Parsing meta tags from https://golang.org/x/sys?go-get=1 (status code 200)^@go: finding github.com/golangci/revgrep latest^@get "golang.org/
x/sys": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at https://golang.org/x/sys?go-get=1^@go: finding github.com/golangci/gosec latest^@go: finding github.com/golangci/maligned latest^@Fetching https://go
pkg.in/check.v1?go-get=1^@go: finding github.com/mozilla/tls-observatory latest^@go: finding golang.org/x/crypto latest^@Fetching https://mvdan.cc/interfacer?go-get=1^@Fetching https://gopkg.in/gemnasium/logrus-airbrake-hook.v2?go-get=1^@Parsing meta tags from https://gop
kg.in/check.v1?go-get=1 (status code 200)^@get "gopkg.in/check.v1": found meta tag get.metaImport{Prefix:"gopkg.in/check.v1", VCS:"git", RepoRoot:"https://gopkg.in/check.v1"} at https://gopkg.in/check.v1?go-get=1^@Parsing meta tags from https://gopkg.in/gemnasium/logrus-a
irbrake-hook.v2?go-get=1 (status code 200)^@get "gopkg.in/gemnasium/logrus-airbrake-hook.v2": found meta tag get.metaImport{Prefix:"gopkg.in/gemnasium/logrus-airbrake-hook.v2", VCS:"git", RepoRoot:"https://gopkg.in/gemnasium/logrus-airbrake-hook.v2"} at https://gopkg.in/g
emnasium/logrus-airbrake-hook.v2?go-get=1^@Parsing meta tags from https://mvdan.cc/interfacer?go-get=1 (status code 200)^@get "mvdan.cc/interfacer": found meta tag get.metaImport{Prefix:"mvdan.cc/interfacer", VCS:"git", RepoRoot:"https://github.com/mvdan/interfacer"} at h
ttps://mvdan.cc/interfacer?go-get=1^@go: finding github.com/golangci/gocyclo latest^@go: finding golang.org/x/sys latest^@Fetching https://gopkg.in/yaml.v2?go-get=1^@go: finding github.com/golangci/gofmt latest^@Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (st
atus code 200)^@get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1^@go: finding mvdan.cc/interfacer latest^@go: finding gopkg.in/check.v1 latest^@go: finding
 github.com/shurcooL/go-goon latest^@go: finding github.com/golangci/unconvert latest^@Fetching https://gopkg.in/tomb.v1?go-get=1^@Parsing meta tags from https://gopkg.in/tomb.v1?go-get=1 (status code 200)^@go: finding github.com/shurcooL/go latest^@get "gopkg.in/tomb.v1"
: found meta tag get.metaImport{Prefix:"gopkg.in/tomb.v1", VCS:"git", RepoRoot:"https://gopkg.in/tomb.v1"} at https://gopkg.in/tomb.v1?go-get=1^@go: finding github.com/OpenPeeDeeP/depguard latest^@Fetching https://gopkg.in/errgo.v2?go-get=1^@Parsing meta tags from https:/
/gopkg.in/errgo.v2?go-get=1 (status code 200)^@get "gopkg.in/errgo.v2": found meta tag get.metaImport{Prefix:"gopkg.in/errgo.v2", VCS:"git", RepoRoot:"https://gopkg.in/errgo.v2"} at https://gopkg.in/errgo.v2?go-get=1^@go: finding gopkg.in/tomb.v1 latest^@go: finding githu
b.com/golangci/lint-1 latest^@go: finding github.com/StackExchange/wmi latest^@Fetching https://gopkg.in/fsnotify.v1?go-get=1^@go: sourcegraph.com/sourcegraph/[email protected]: parsing go.mod: unexpected module path "github.com/sourcegraph/go-diff"^@Parsing meta tags from h
ttps://gopkg.in/fsnotify.v1?go-get=1 (status code 200)^@go: finding github.com/golangci/goconst latest^@get "gopkg.in/fsnotify.v1": found meta tag get.metaImport{Prefix:"gopkg.in/fsnotify.v1", VCS:"git", RepoRoot:"https://gopkg.in/fsnotify.v1"} at https://gopkg.in/fsnotif
y.v1?go-get=1^@go: finding github.com/nbutton23/zxcvbn-go latest^@go get: error loading module requirements^@

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 27, 2019

Put vim-go in your runtimepath. :GoInstallBinaries does not install vim-go, it installs all the binaries that vim-go requires to operate. Please see the readme and :help plugin.

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 27, 2019

Ah. Just make sure your working directory is in GOPATH when you run :GoInstallBinaries.

@drewthor
Copy link
Author

I am running this when in /Users/Andrew/go

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 27, 2019

It's odd that your $GOMOD is /dev/null and the output you're receiving is consistent with using module mode. What is the output of :echo getcwd()?

@drewthor
Copy link
Author

I believe I should be using module mode; I have been using it in one of my projects that is located outside of $GOPATH. It appears that I have macvim installed instead of vim via brew. Might that be it?

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 27, 2019

It's fine to use module mode in general, but not when installing gometalinter.

@drewthor
Copy link
Author

I have been running in the terminal

/Users/Andrew/go $ vim
:GoUpdateBinaries

Should I turn off module mode, install gometalinter, and then turn back on module mode?

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 27, 2019

Yes

@drewthor
Copy link
Author

That solved it 👍 Thank you so much!

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 27, 2019

I'm reopening this, because vim-go can improve the user experience and eliminate the workaround of having to be in GOPATH to install some binaries.

@bhcleek bhcleek reopened this Apr 27, 2019
@bhcleek bhcleek changed the title Cannot install vim-go Some binaries require GOPATH mode to be installed Apr 27, 2019
@bhcleek
Copy link
Collaborator

bhcleek commented Apr 28, 2019

@drewthor can you clarify a couple of things that may help me fix this permanently in vim-go?

You said:

I am running this when in /Users/Andrew/go

and

I believe I should be using module mode; I have been using it in one of my projects that is located outside of $GOPATH

I'm not sure how to reconcile those two statement given GOPATH="/Users/Andrew/go". Can you clarify?

Also, what was GO111MODULE set to?

@drewthor
Copy link
Author

I had a project not underneath my GOPATH; I had module mode GO111MODULE=on in order to work outside of the GOPATH and had been for at least a month (using vscode).

When attempting to install vim-go via :GoInstallBinaries, I had opened vim (with no file opened) under my GOPATH.

I had GO111MODULE=on when the installation was failing. Setting GO111MODULE=off allowed the install to succeed successfully.

bhcleek added a commit to bhcleek/vim-go that referenced this issue May 1, 2019
Set GO111MODULE=off when install tools, because some tools'
(gometalinter and golangci-lint at this writing) won't install in module
mode.

Fixes fatih#2248
bhcleek added a commit to bhcleek/vim-go that referenced this issue May 1, 2019
Set GO111MODULE=off when installing tools, because some tools'
(gometalinter and golangci-lint at this writing) won't install in module
mode.

Add a new function, go#util#SetEnv to make it easy to set and restore
environment variable correctly.

Fixes fatih#2248
bhcleek added a commit to bhcleek/vim-go that referenced this issue May 1, 2019
Set GO111MODULE=off when installing tools, because some tools'
(gometalinter and golangci-lint at this writing) won't install in module
mode.

Add a new function, go#util#SetEnv, to make it easy to set and restore
environment variables correctly.

Fixes fatih#2248
bhcleek added a commit to bhcleek/vim-go that referenced this issue May 1, 2019
Set GO111MODULE=off when installing tools, because some tools'
(gometalinter and golangci-lint at this writing) won't install in module
mode.

Add a new function, go#util#SetEnv, to make it easy to set and restore
environment variables correctly.

Fixes fatih#2248
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 a pull request may close this issue.

2 participants