Skip to content

settings: support predefined variables in go.toolsEnvVars #413

@edp1096

Description

@edp1096

Please direct general questions to:

Please review the documentation before filing an issue.
Helpful pages include:

Please answer these questions before submitting your issue. Thanks!

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

  • Run go version to get version of Go
    • go version go1.14.4 windows/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 버전: 1.47.2
      커밋: 17299e413d5590b14ab0340ea477cdd86ff13daf
      날짜: 2020-07-15T18:22:06.216Z
      Electron: 7.3.2
      Chrome: 78.0.3904.130
      Node.js: 12.8.1
      V8: 7.8.279.23-electron.0
      OS: Windows_NT x64 10.0.18363
  • Check your installed extensions to get the version of the VS Code Go extension
  • Run go env to get the go development environment details
	- ws$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=D:\devs\pcbangstudio\user\gocache
set GOENV=D:\devs\pcbangstudio\user\userprofile\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\devs\pcbangstudio\user\gopath
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=D:\devs\pcbangstudio\tools\langs\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\devs\pcbangstudio\tools\langs\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\devs\pcbangstudio\workspace\chsn-inventory\ws\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=D:\devs\pcbangstudio\user\tmp\go-build876394286=/tmp/go-build -gno-record-gcc-switches
ws$

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

    "go.toolsEnvVars": {
        "GOARCH": "amd64",
        "GOOS": "windows",
        "GOBIN": "${workspaceFolder}/bin"
    },
    "go.useLanguageServer": true,
    "[go]": {
        "editor.snippetSuggestions": "none",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
            "source.fixAll": true,
        },
        "editor.defaultFormatter": "golang.go"
    },
    "files.eol": "\n",
    "gopls": {
        "usePlaceholders": true // add parameter placeholders when completing a function
    },
    "go.languageServerExperimentalFeatures": {
        "format": true,
        "autoComplete": true,
        "rename": true,
        "goToDefinition": true,
        "hover": true,
        "signatureHelp": true,
        "goToTypeDefinition": true,
        "goToImplementation": true,
        "documentSymbols": true, // =outline
        "workspaceSymbols": true,
        "findReferences": true
    },
    "go.languageServerFlags": [],
    "go.docsTool": "gogetdoc",
    "go.formatTool": "goimports",
    "go.gocodeAutoBuild": true,

Describe the bug

A clear and concise description of what the bug.
A clear and concise description of what you expected to happen.

When use install features with Predefined variable of vscode, vscode-go cannot recognize the path value.

  • Go: Install Current Package - Output message when try to install my source to GOBIN where I specified.
Installing current package
Installation failed: cannot install, GOBIN must be an absolute path
  • Go: Install/Update Tools - Output message when try to install go tools by vscode-go.
Tools environment: GOPATH=D:\devs\pcbangstudio\user\gopath, GOBIN=${workspaceFolder}/bin
Installing 1 tool at the configured GOBIN: ${workspaceFolder}/bin in module mode.
  gopls

Installing golang.org/x/tools/gopls FAILED

1 tools failed to install.

gopls: failed to install [object Object]: Error: Command failed: D:\devs\pcbangstudio\tools\langs\go\bin\go.exe get -v golang.org/x/tools/gopls
go: golang.org/x/tools/gopls upgrade => v0.4.3
cannot install, GOBIN must be an absolute path
 undefined  

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions