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

gopls: Unable to build on vscode #35531

Closed
byteshiva opened this issue Nov 12, 2019 · 4 comments
Labels

Comments

@byteshiva
Copy link

@byteshiva byteshiva commented Nov 12, 2019

What did you do?

I'm trying to build go source file using gopls on Microsoft vscode. Instead of executing go build on the specific file, it fails to execute the build command.
note:
I'm using go version manager to maintain its different go runtimes.

Here is the code.
https://play.golang.com/p/HhCLwAZhaBk

What did you expect to see?

It should build a specific file.

What did you see instead?

It's not building the specific file.

Build info

golang.org/x/tools/gopls 0.2.0
    golang.org/x/tools/gopls@v0.2.0 h1:ddCHfScTYOG6auAcEKXCFN5iSeKSAnYcPv+7zVJBd+U=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20191108194844-46f05828f2fe h1:FNzasIzfY1IIdyTs/+o3Qv1b7YdffPbBXyjZ5VJJdIA=
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=

Go info

go version go1.13.4 linux/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xyz/.cache/go-build"
GOENV="/home/xyz/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/xyz/.asdf/installs/golang/1.13.4/packages"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/xyz/.asdf/installs/golang/1.13.4/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/xyz/.asdf/installs/golang/1.13.4/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-build321841077=/tmp/go-build -gno-record-gcc-switches"

settings on vscode

{
    "go.gopath": "/home/xyz/.asdf/installs/golang/1.13.4/packages",
    "go.goroot": "/home/xyz/.asdf/installs/golang/1.13.4/go",
    "terminal.integrated.shellArgs.linux": ["-l"],
    "terminal.integrated.automationShell.linux": "/bin/bash",
    "go.useLanguageServer": true,
    "[go]": {
        "editor.snippetSuggestions": "none",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        }
    },
    "go.languageServerExperimentalFeatures": {
        "format": true,
        "autoComplete": true,
        "rename": true,
        "goToDefinition": true,
        "hover": true,
        "signatureHelp": true,
        "goToTypeDefinition": true,
        "goToImplementation": true,
        "documentSymbols": true,
        "workspaceSymbols": true,
        "findReferences": true,
        "diagnostics": true,
    },
    "go.languageServerFlags": [
        "-rpc.trace", // for more detailed debug logging
        "serve",
        "--debug=localhost:6060", // to investigate memory usage, see profiles 
    ],
    "gopls": {
        "usePlaceholders": true, // add parameter placeholders when completing a function

        // Experimental settings
        "completeUnimported": true, // autocomplete unimported packages
        "watchFileChanges": true,  // watch file changes outside of the editor
        "deepCompletion": true,     // enable deep completion
    },
    "files.eol": "\n", // formatting only supports LF line endings
}
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 12, 2019

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.

@gopherbot gopherbot added the gopls label Nov 12, 2019
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Nov 12, 2019

gopls does not execute builds in VS Code, so I think your issue should be moved to the https://github.com/microsoft/vscode-go repository.

@byteshiva

This comment has been minimized.

Copy link
Author

@byteshiva byteshiva commented Nov 13, 2019

Thanks I'll move this bug to vscode-go.

Are there any timeline when the buildOnSave would be made available on gopls

gopls does not execute builds in VS Code, so I think your issue should be moved to the https://github.com/microsoft/vscode-go repository.

Raised bug on vscode-go
microsoft/vscode-go#2901

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Nov 13, 2019

There currently isn't any plan for this feature, but this is something we might be able to do via a CodeLens. Closing this issue for now, as it is not yet a planned feature, but we will likely investigate this in the future.

@stamblerre stamblerre closed this Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.