Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

workspaceFolderBasename not populated in go.goroot setting #2310

Closed
bentekkie opened this issue Jun 30, 2022 · 3 comments
Closed

workspaceFolderBasename not populated in go.goroot setting #2310

bentekkie opened this issue Jun 30, 2022 · 3 comments
Labels
FrozenDueToAge HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors.
Milestone

Comments

@bentekkie
Copy link
Contributor

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.

    • go1.19-pre4 cl/455575533 +12f49fe0ed linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

    • v0.8.4
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.

    • 1.68.1
      30d9c6cd9483b2cc586687151bcbcd635f373630
      x64
  • Check your installed extensions to get the version of the VS Code Go extension

    • v0.34.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

    • Checking configured tools....
      GOBIN: undefined
      toolsGopath:
      gopath: /usr/local/google/home/bentekkie/go
      GOROOT: /usr/lib/google-golang
      PATH: /usr/local/google/home/bentekkie/depot_tools:/usr/local/google/home/bentekkie/.cargo/bin:/usr/local/google/home/bentekkie/.local/bin:/usr/local/google/home/bentekkie/.local/bin:/usr/lib/google-golang/bin:/usr/local/buildtools/java/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/google/home/bentekkie/go/bin

    go: /usr/lib/google-golang/bin/go: go version go1.19-pre4 cl/455575533 +12f49fe0ed linux/amd64

    gotests: /usr/local/google/home/bentekkie/go/bin/gotests (version: v1.6.0 built with go: go1.19-pre4)
    gomodifytags: /usr/local/google/home/bentekkie/go/bin/gomodifytags (version: v1.16.0 built with go: go1.19-pre4)
    impl: /usr/local/google/home/bentekkie/go/bin/impl (version: v1.1.0 built with go: go1.19-pre4)
    goplay: /usr/local/google/home/bentekkie/go/bin/goplay (version: v1.0.0 built with go: go1.19-pre4)
    dlv: /usr/bin/dlv (version: unknown - )
    golint: /usr/local/google/home/bentekkie/go/bin/golint (version: v0.0.0-20210508222113-6edffad5e616 built with go: go1.19-pre4)
    gopls: /usr/local/google/home/bentekkie/go/bin/gopls (version: v0.8.4 built with go: go1.19-pre4)

go env
Workspace Folder (master): /usr/local/google/home/bentekkie/Workspace/re-client/master
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bentekkie/.cache/go-build"
GOENV="/usr/local/google/home/bentekkie/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bentekkie/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bentekkie/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/google-golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19-pre4 cl/455575533 +12f49fe0ed"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3745075455=/tmp/go-build -gno-record-gcc-switches"

Workspace Folder (statustoolhttp): /usr/local/google/home/bentekkie/Workspace/re-client/statustoolhttp
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bentekkie/.cache/go-build"
GOENV="/usr/local/google/home/bentekkie/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bentekkie/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bentekkie/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/google-golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19-pre4 cl/455575533 +12f49fe0ed"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build884252437=/tmp/go-build -gno-record-gcc-switches"

Workspace Folder (gvisor): /usr/local/google/home/bentekkie/Workspace/re-client/gvisor
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bentekkie/.cache/go-build"
GOENV="/usr/local/google/home/bentekkie/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bentekkie/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bentekkie/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/google-golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19-pre4 cl/455575533 +12f49fe0ed"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build428995912=/tmp/go-build -gno-record-gcc-switches"

Workspace Folder (version-bump): /usr/local/google/home/bentekkie/Workspace/re-client/version-bump
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bentekkie/.cache/go-build"
GOENV="/usr/local/google/home/bentekkie/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bentekkie/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bentekkie/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/google-golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19-pre4 cl/455575533 +12f49fe0ed"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2116730961=/tmp/go-build -gno-record-gcc-switches"

Workspace Folder (reproxystatus): /usr/local/google/home/bentekkie/Workspace/re-client/reproxystatus
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bentekkie/.cache/go-build"
GOENV="/usr/local/google/home/bentekkie/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bentekkie/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bentekkie/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/google-golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/google-golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19-pre4 cl/455575533 +12f49fe0ed"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1371867421=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

"settings": {
        "go.goroot": "${workspaceFolder}/bazel-${workspaceFolderBasename}/external/go_sdk",
        "go.toolsEnvVars": {
            "GOPACKAGESDRIVER": "/usr/local/google/home/bentekkie/.tools/gopackagesdriver.sh"
        },
        "go.enableCodeLens": {
            "references": false,
            "runtest": false
        },
        "gopls": {
            "build.directoryFilters": [
                "-bazel-bin",
                "-bazel-out",
                "-bazel-testlogs",
                "-bazel-mypkg",
                "-docker"
            ],
            "formatting.local": "github.com/my/mypkg",
            "ui.completion.usePlaceholders": true,
            "ui.semanticTokens": true,
            "ui.codelenses": {
                "gc_details": false,
                "regenerate_cgo": false,
                "generate": false,
                "test": false,
                "tidy": false,
                "upgrade_dependency": false,
                "vendor": false
            },
        },
        "go.useLanguageServer": true,
        "go.buildOnSave": "off",
        "go.lintOnSave": "off",
        "go.vetOnSave": "off",
        "bazel.enableCodeLens": true,
        "gitlens.remotes": [
            {
                "type": "Gerrit",
                "domain": "team"
            }
        ],
        "[go]": {
            "editor.formatOnSave": true,
            "editor.codeActionsOnSave": {
                "source.fixAll": false,
                "source.organizeImports": false
            }
        },
        "go.lintTool": "golint",
        "go.formatTool": "gofmt",
        "editor.formatOnSave": true,
    }

Describe the bug

I used the ${workspaceFolderBasename} variable in the go.goroot settings entry and it was not populated.
I expected it to be populated as ${workspaceFolder} is correctly populated

Steps to reproduce the behavior:

  1. Use ${workspaceFolderBasename} in go.goroot settings entry
  2. See error. Example error:
go.goroot setting is ignored. /usr/local/google/home/bentekkie/Workspace/re-client/master/bazel-${workspaceFolderBasename}/external/go_sdk is not a valid GOROOT directory.
@gopherbot gopherbot added this to the Untriaged milestone Jun 30, 2022
@bentekkie
Copy link
Contributor Author

I think this is due to only ${workspaceFolder} being handled in

inputPath = inputPath.replace(/\${workspaceFolder}|\${workspaceRoot}/g, workspaceFolder);

@hyangah
Copy link
Contributor

hyangah commented Jul 6, 2022

VSCode does not support variables resolution in settings.json microsoft/vscode#2809. As a workaround, the extension has its own hack to resolve a couple of frequently used variables. workspaceFolderBasename is not one of them.

@bentekkie Yes, that's the right place. Contribution is welcome!

@hyangah hyangah added the HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors. label Jul 6, 2022
@hyangah hyangah modified the milestones: Untriaged, vscode-go/unplanned Jul 6, 2022
@gopherbot
Copy link
Collaborator

Change https://go.dev/cl/416194 mentions this issue: Substitute workspaceFolderBasename variable into extension settings

@hyangah hyangah modified the milestones: vscode-go/unplanned, v0.35.0 Jul 13, 2022
@golang golang locked and limited conversation to collaborators Jul 13, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
FrozenDueToAge HelpWanted Issues that are not prioritized by the maintainers. Help is requested from community contributors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants