-
Notifications
You must be signed in to change notification settings - Fork 763
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
error loading workspace...outside module and outside $GOPATH/src #2637
Comments
@ricky-charlet It looks like the error message "outside module and outside $GOPATH/src" is exactly what's happening. Your workspace root is And the workspace directory does't have Can you tell me why you want to have your Are you using Go modules or do you need to use the old Currently this extension assumes the workspace to be organized in certain ways as described in https://github.com/golang/vscode-go#setting-up-your-workspace. We have a plan to improve UX by removing this restriction (golang/go#57979) this year, but now you will need to either have your workspace folder under GOPATH or in a module or use |
Thanks Hyang-Ah, I'm still hoping this is really a configuration problem... Now I will explain my (admittedly) complex setup. I work at an enterprise where we compile a very large software set to run on an embedded device we sell. The compile task is equivalent (or larger) than building an entire linux distribution. Many people work on many parts. I personally am currently focused on only one daemon of the whole large set. And the daemon I have responsibility for is in golang. my direcorty stucture will be So I do not want to parse all of halon-src, only subdirectory parts of it. ---copy--- |
Option 1: If you want to keep your projects in the old GOPATH mode, Option 2: You may want to open a separate window for each project (hpe-policyd or go-log or ..). Since you don't want to adopt Go modules, I think explicitly disabling the module mode ( |
"the go language server does not support a multiroot environment." Sooo...I got it working. I pulled out a sledge hammer and:
Seems it is working now. And I don't know which among those things was helpful. |
I'm confident I had some type of config error in my environment that I wound up healing by reinstalling golang and vscode:go extension. So...not a bug in vscode or vscode:go. I'll mark this closed. |
BUT!!! I do want respect for my use case please.... where I can direct vscode:go to parse only a subset of codedirs. And don't tell me to solve this with modules...just parse the list of directories I can point at please. This is achievable right now, but the UI requires I edit settings.json files and forums have a difficult time believing I really want to do this. It should be simpler for me to instruct vscode:go where my directories are. |
Howdy,
I'm using vscode 1.74.3
extension: remote-ssh 0.94.0 preview
(on remote installed) extension: go 0.37.1
I have an environment with a complex goroot and gopath which I accept the responsibility for manually configuring in my settings.
When opening my workspace, the go extension shows this error message:
----copy---
Error loading workspace: You are outside of a module and outside of $GOPATH/src. If you are using modules, please open your editor to a directory in your module. If you believe this warning is incorrect, please file an issue: https://github.com/golang/go/issues/new.
----paste---
Yet, I am quite certain my code is in $GOPATH/src.
Here are some diagnostic outputs:
my goextension-workspace settings file is
----copy---
{
"folders": [
{
"path": "halon/halon-src"
},
],
"settings": {
"go.languageServerFlags": [
}
----paste----
(on remote) output of ls /ws/charletr/halon/halon-src/hpe-policyd:
--- copy---
charletr@hpnsw4371:
$ ls /ws/charletr/halon/halon-src/hpe-policyd$ ls /ws/charletr/halon/halon-src/hpe-policyd/src/rdlabs.hpecorp.net/hpe-policyd/cleanup_alerts.sh c_src metadata.json NAE_DESIGN.md ops-tests pkg REVIEWERS sandbox.proto scripts src templateapi tools
charletr@hpnsw4371:
action agent database eventlog Gopkg.lock internal log main.go mock script utils vsx
adc capacities errpolicyd events Gopkg.toml libsandbox main_coverage_test.go main_test.go parser system_manager vendor watchdog
charletr@hpnsw4371:
$$ ls /ws/charletr/halon/build-genericx86-p4/tmp/work/core2-64-cnos-linux/hpe-policyd/1.0-r0/recipe-sysroot/usr/lib/gocharletr@hpnsw4371:
pkg src
charletr@hpnsw4371:~$
---- paste ---
output of vscode go env:
----copy---
go env
Workspace Folder (halon-src): /ws/charletr/halon/halon-src
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/users/charletr/.cache/go-build"
GOENV="/users/charletr/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/ws/charletr/halon/halon-src/hpe-policyd/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/ws/charletr/halon/halon-src/hpe-policyd"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/ws/charletr/halon/build-genericx86-p4/tmp/work/core2-64-cnos-linux/hpe-policyd/1.0-r0/recipe-sysroot/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/ws/charletr/halon/build-genericx86-p4/tmp/work/core2-64-cnos-linux/hpe-policyd/1.0-r0/recipe-sysroot/usr/lib/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="-L --sysroot="
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build697172772=/tmp/go-build -gno-record-gcc-switches"
----paste---
The text was updated successfully, but these errors were encountered: