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

x/tools/gopls: "You are neither in a module nor in your GOPATH issue" warning message #38720

Closed
idopshik opened this issue Apr 28, 2020 · 7 comments
Closed
Labels
Milestone

Comments

@idopshik
Copy link

@idopshik idopshik commented Apr 28, 2020

What version of Go are you using (go version)?

$ go version
go1.14.2 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/st/.cache/go-build"
GOENV="/home/st/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/st/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build613495954=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I'm trying to write a SYMBOL, every symbol - and go error

echo $GOPATH output -
/home/st/go

I'm having a file in /home/st/go/srs/.../myfile.go
(it's a go paht ,right? since $GOPATH output is /home/st/go

I open that file in VIM editor (latest version, with Coc latest version) trying to type and got
this issue - "you neither in gopath or module ...".
But I'm in GOPATH, right?

What did you expect to see?

Dont' want to see interruptions

What did you see instead?

@hyangah hyangah changed the title You are neither in a module nor in your GOPATH issue x/tools/gopls: "You are neither in a module nor in your GOPATH issue" warning message Apr 28, 2020
@gopherbot gopherbot added this to the Unreleased milestone Apr 28, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 28, 2020

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 Apr 28, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Apr 28, 2020

@idopshik: Is your file in /home/st/go/srs/.../myfile.go or /home/st/go/src/.../myfile.go? The folders directly below the $GOPATH should be bin, src, and pkg (https://golang.org/doc/gopath_code.html#Organization).

@idopshik
Copy link
Author

@idopshik idopshik commented Apr 28, 2020

/src
of coarse it's src (for source). Just fatfingered here, nor in my filesystem. And also I didn't created these folders - Entire /home/user/go folder with lots of nested folders was generated automatically by golang installer.

I did everything, spent few hours trying different methods. Ended up using YCM (so, no server, no problem. It made me nuts!)

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Apr 28, 2020

From what I understand, YCM does use gopls (though I may be mistaken). What directory were you opening in Vim?

@idopshik
Copy link
Author

@idopshik idopshik commented Apr 28, 2020

hm. You're right. just disabled vim-go, and then tried to move gopls in different place - both affected YCM's ability to complete.
This way It seems that Coc completion manager to blame?

Of course vim's :pwd is the same as file's - inside the GOPATH. YCM works well enough. (w/o language-server's feedback thou, but it's lesser from two evils)
Should I close the issue since it seems like other program's fault?

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Apr 28, 2020

If you're able to get a gopls log (not sure how to do that in Vim), I can take a look, but yes, I'd suggest filing an issue with coc.vim - they should be able to help you debug the issue.

@idopshik idopshik closed this Apr 29, 2020
@idopshik
Copy link
Author

@idopshik idopshik commented Apr 29, 2020

For Coc everything that needed it to run inside VIM :CocConfig and add this.

{ "languageserver": { "golang": { "command": "gopls", "args": ["serve", "-debug", "0.0.0.0:8484", "-rpc.trace"], "rootPatterns": ["go.mod"], "disableWorkspaceFolders": true, "filetypes": ["go"] } } }

Then in the browser at http://localhost:8484/ I've got from different sections:

Environment

SHELL=/bin/bash
SESSION_MANAGER=local/moo:@/tmp/.ICE-unix/4486,unix/moo:/tmp/.ICE-unix/4486
QT_ACCESSIBILITY=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_MENU_PREFIX=xfce-
GTK_IM_MODULE=xim
CLUTTER_BACKEND=x11
LANGUAGE=en_US
QT4_IM_MODULE=xim
MANDATORY_PATH=/usr/share/gconf/xubuntu.mandatory.path
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
TERMINATOR_UUID=urn:uuid:e63d9e19-e963-437c-b4c0-2b7d18dbddb9
XMODIFIERS=@im=none
DESKTOP_SESSION=xubuntu
SSH_AGENT_PID=4575
GOBIN=/home/st/go/bin
XDG_SEAT=seat0
PWD=/home/st
LOGNAME=st
XDG_SESSION_DESKTOP=xubuntu
QT_QPA_PLATFORMTHEME=gtk2
XDG_SESSION_TYPE=x11
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
XAUTHORITY=/home/st/.Xauthority
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/st
GDM_LANG=en_US
HOME=/home/st
IM_CONFIG_PHASE=2
LANG=en_US.utf8
XDG_CURRENT_DESKTOP=XFCE
VTE_VERSION=5602
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
CLUTTER_IM_MODULE=xim
XDG_SESSION_CLASS=user
TERM=dumb
GTK_OVERLAY_SCROLLING=0
DEFAULTS_PATH=/usr/share/gconf/xubuntu.default.path
USER=st
DISPLAY=:0.0
SHLVL=1
XDG_VTNR=7
XDG_SESSION_ID=c4
XDG_RUNTIME_DIR=/run/user/1000
PS1=\[\u@\h:\]\[�(B�[m\]\[\033[38;5;6m\][\[�(B�[m\]\[\033[38;5;14m\]\w\[�(B�[m\]\[\033[38;5;6m\]]\[�(B�[m\]`parse_git_branch`$ \[�(B�[m\]
XDG_DATA_DIRS=/usr/share/xfce4:/usr/share/xubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/st/.local/bin:/home/st/go/bin:/usr/local/go/bin:/home/st/.fzf/bin
GDMSESSION=xubuntu
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
GOPATH=/home/st/go
_=/usr/bin/vim
VIMRUNTIME=/usr/share/vim/vim82
VIM=/usr/share/vim
MYVIMRC=/home/st/.vimrc
COC_VIMCONFIG=/home/st/.vim
COC_DATA_HOME=/home/st/.config/coc
ROWS=37
LINES=37
COLUMNS=136
COLORS=256
VIM_SERVERNAME=
COC_NVIM=1
VIM_NODE_RPC=1
COC_CHANNEL_TIMEOUT=30`

/metric (two counters incrementes as the red message in Vim appears)

HELP started Count of RPCs started by method.

started{[direction="out" method="window/logMessage"]} 14

started{[direction="out" method="window/showMessage"]} 3

from the "trace" section some lines from above (I believe most recently added by the server)

cache.importer.typeCheck
Last

253.824µs cache.importer.typeCheck 338.588µs name="cache.importer.typeCheck" package="github.com/idopshik/test_str_iter"
    280.701µs cache.parseGo 133.006µs name="cache.parseGo" file="/home/st/go/src/github.com/idopshik/test_str_iter/test.go"

Longest

123.693046ms cache.importer.typeCheck 291.11585ms name="cache.importer.typeCheck" package="github.com/idopshik/test_str_iter"
    123.740311ms cache.parseGo 54.583µs name="cache.parseGo" file="/home/st/go/src/github.com/idopshik/test_str_iter/test.go"
    123.863221ms cache.importer.typeCheck 257.326149ms name="cache.importer.typeCheck" package="errors"
        123.891102ms cache.parseGo 224.716µs name="cache.parseGo" file="/usr/local/go/src/errors/wrap.go"
            123.911387ms cache.nativeFileHandle.Read 41.83µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/errors/wrap.go"
        145.378334ms cache.parseGo 119.088µs name="cache.parseGo" file="/usr/local/go/src/errors/errors.go"
            145.405185ms cache.nativeFileHandle.Read 31.769µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/errors/errors.go"
    124.127521ms cache.importer.typeCheck 264.890976ms name="cache.importer.typeCheck" package="internal/fmtsort"
        124.155322ms cache.parseGo 421.567µs name="cache.parseGo" file="/usr/local/go/src/internal/fmtsort/sort.go"
            124.175793ms cache.nativeFileHandle.Read 42.737µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/internal/fmtsort/sort.go"
    124.593177ms cache.importer.typeCheck 219.473209ms name="cache.importer.typeCheck" package="math"
        124.654822ms cache.parseGo 131.921µs name="cache.parseGo" file="/usr/local/go/src/math/unsafe.go"
            124.673251ms cache.nativeFileHandle.Read 32.527µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/unsafe.go"
        136.047227ms cache.parseGo 838.383µs name="cache.parseGo" file="/usr/local/go/src/math/signbit.go"
            136.081722ms cache.nativeFileHandle.Read 40.134µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/signbit.go"
        145.726053ms cache.parseGo 193.122µs name="cache.parseGo" file="/usr/local/go/src/math/abs.go"
            145.751287ms cache.nativeFileHandle.Read 138.987µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/abs.go"
        145.765322ms cache.parseGo 206.401µs name="cache.parseGo" file="/usr/local/go/src/math/acosh.go"
            145.788459ms cache.nativeFileHandle.Read 97.073µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/acosh.go"
        145.988622ms cache.parseGo 135.738µs name="cache.parseGo" file="/usr/local/go/src/math/asin.go"
            146.007509ms cache.nativeFileHandle.Read 29.533µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/asin.go"
        146.471531ms cache.parseGo 151.653µs name="cache.parseGo" file="/usr/local/go/src/math/asinh.go"
            146.4923ms cache.nativeFileHandle.Read 32.861µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/asinh.go"
        146.637966ms cache.parseGo 175.992µs name="cache.parseGo" file="/usr/local/go/src/math/atan.go"
            146.656242ms cache.nativeFileHandle.Read 36.639µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/atan.go"
        146.828578ms cache.parseGo 310.269µs name="cache.parseGo" file="/usr/local/go/src/math/atan2.go"
            146.846259ms cache.nativeFileHandle.Read 28.664µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/atan2.go"
        147.156951ms cache.parseGo 143.465µs name="cache.parseGo" file="/usr/local/go/src/math/atanh.go"
            147.176877ms cache.nativeFileHandle.Read 36.01µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/atanh.go"
        147.314427ms cache.parseGo 146.399µs name="cache.parseGo" file="/usr/local/go/src/math/bits.go"
            147.331634ms cache.nativeFileHandle.Read 29.972µs name="cache.nativeFileHandle.Read" file="/usr/local/go/src/math/bits.go"

Don't know what to post exactly, just wanted to be concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.