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

unable to go to definition. Fails with module lookup disabled by GOPROXY=off #3288

Closed
rickydjohn opened this issue Aug 25, 2021 · 1 comment

Comments

@rickydjohn
Copy link

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

gd is supposed to take me to a function/method definition. instead, it failed with a module load error. While inspecting messages on vim, I found the below message.

vim-go: initializing gopls
vim-go: initialized gopls
vim-go: Finished loading packages.
vim-go: Finished loading packages.
vim-go: [definition] FAIL
vim-go: err: exit status 1: stderr: go: bitbucket.org/xxxx/[email protected]: module lookup disabled by GOPROXY=off
vim-go: : packages.Load error

What did you expect to happen?

I was hoping to be taken to the function/method

What happened instead?

the lookup failed with an error.

Configuration (MUST fill this out):

vim-go version:

vimrc you used to reproduce:

<details><summary>vimrc</summary>
set tags+=~/Projects/tags
set path+=**
set spell
set shiftwidth=2
set tabstop=2
filetype plugin on                  " required
command! MakeTags !ctags -R ~/Projects/tags
syntax on
let mapleader = "g"
nnoremap tn :tabnew<CR>
nnoremap tc :tabclose<CR>
nnoremap tN :tabNext<CR>
nnoremap tP :tabPrevious<CR>
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'davidhalter/jedi-vim'
Plugin 'fatih/vim-go'
let g:go_fmt_command = "goimports"        
let g:go_auto_type_info = 1               
let g:go_addtags_transform = "camelcase"
let g:go_highlight_methods = 1
au filetype go inoremap <buffer> . .<C-x><C-o>
let g:go_debug_windows = {
      \ 'vars':       'rightbelow 60vnew',
      \ 'stack':      'rightbelow 10new',
                        \ }
call vundle#end()            " required
filetype plugin indent on    " required
nnoremap no :NERDTreeToggle<CR>

Vim version (first three lines from :version):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 11 2020 17:00:59)
Included patches: 1-716
Modified by [email protected]

Go version (go version):

go version go1.15.7 linux/amd64

Go environment

go env Output:
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/ricky/Projects/bin/"
GOCACHE="/home/ricky/.cache/go-build"
GOENV="/home/ricky/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ricky/Projects/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ricky/Projects/"
GOPRIVATE=""
GOPROXY="off"
GOROOT="/usr/lib/go-1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.15/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ricky/Projects/src/bitbucket.org/xxx/xxx/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build918085375=/tmp/go-build -gno-record-gcc-switches"

gopls version

gopls version Output:
golang.org/x/tools/gopls v0.7.0
    golang.org/x/tools/[email protected] h1:JQBHW81Gsyim6iDjUwGoPeSpXrSqwen3isPJLfDfaYU=

vim-go configuration:

vim-go configuration
g:go_fmt_command = 'goimports'
g:go_auto_type_info = 1
g:go_jump_to_error = 1
g:go_debug_windows = {'vars': 'rightbelow 60vnew', 'stack': 'rightbelow 10new'}
g:go_highlight_methods = 1
g:go_loaded_install = 1
g:go_loaded_gosnippets = 1
g:go_addtags_transform = 'camelcase'

filetype detection configuration:

filetype detection
filetype detection:ON  plugin:ON  indent:ON
@bhcleek
Copy link
Collaborator

bhcleek commented Aug 28, 2021

You're effectively running into the problem that's described in golang/go#32337, and there's not much (nothing?) that vim-go can really do about it.

I suspect that if you download your dependencies before setting GOPROXY=off or if you use some of the suggestions in golang/go#32337, then you'll be fine.

Are you sure you want GOPROXY=off and that you don't want GOPROXY=direct instead?

@bhcleek bhcleek closed this as completed Sep 4, 2021
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

No branches or pull requests

2 participants