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

vscode Go navigation stops when importing C code at the top #579

Closed
DariusParvin opened this issue Aug 27, 2020 · 2 comments
Closed

vscode Go navigation stops when importing C code at the top #579

DariusParvin opened this issue Aug 27, 2020 · 2 comments
Labels
FrozenDueToAge gopls gopls related issues WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@DariusParvin
Copy link

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.12.1 darwin/amd64
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.48.1
      3dd905126b34dcd4de81fa624eb3a8cbe7485f13
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.16.1
  • Run go env to get the go development environment details

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dariuscognac/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dariuscognac/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dariuscognac/Documents/GitHub/lnd/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/var/folders/r5/yk8yg2xs1gs8xzkn5l8vr72w0000gn/T/go-build550879609=/tmp/go-build -gno-record-gcc-switches -fno-common"

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.useLanguageServer": true,
"go.gopath": "",

Describe the bug

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

Steps to reproduce the behavior:

  1. When I import some C code using these lines of code, the code navigation stops working. Code:
/*
    struct Receive_return receive_cgo(char* msg, int length, void* p);
	char* send_cgo(void* p);
*/
import "C"
  1. When I try to do 'Go to Definition' on an imported interface, it says 'No definition found'
    However, if I remove the quoted code from the top and reload vs code, then code navigation works as expected.

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.
image
image

@stamblerre
Copy link
Contributor

Please take a look at golang/go#35721, as it has more detail about authoring cgo packages using gopls. But first, I would suggest updating to the latest version of Go (1.15). It has a number of cgo-related improvements that enable gopls to work with cgo packages.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 28, 2020
@hyangah hyangah added the gopls gopls related issues label Sep 2, 2020
@gopherbot
Copy link
Collaborator

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls gopls related issues WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants