Skip to content

x/tools/gopls: add tests for cgo #31561

@Kraust

Description

@Kraust

What version of Go are you using (go version)?

❯ go version
go version go1.12.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
❯ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home3/rdupuis/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rdupuis/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build200403948=/tmp/go-build -gno-record-gcc-switches"

What did you do?

See minimal working example in the following repository
https://github.com/Kraust/cgo_gopls
Tested with latest coc.nvim and latest gopls from official repo.
Not listed in the repository is my coc.nvim settings. I do not believe this is a coc.nvim issue but I will post an issue on their tracker if needed:

"coc
inoremap <silent><expr> <TAB>
      \ pumvisible() ? coc#_select_confirm() :
      \ coc#expandableOrJumpable() ? coc#rpc#request('doKeymap', ['snippets-expand-jump','']) :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

let g:coc_snippet_next = '<Tab>'
let g:coc_snippet_prev = '<S-Tab>'

What did you expect to see?

coc.nvim with successful tab-compeltion (autocomplete)

What did you see instead?

coc.nvim's tab completion only works if import "C" is commented out.

Also CocInfo reports the following:

## versions

vim version: NVIM v0.4.0-571-g21b108f
node version: v11.9.0
coc.nvim version: 0.0.65-303d95d2bb
term: xterm-256color
platform: linux

## Error messages

## Output channel: snippets

## Output channel: languageserver.golang
2019/04/18 20:09:19 get package failed: no metadata found for /home/rdupuis/go/src/github.com/kraust/cgo_gopls/cgo_gopls.go
2019/04/18 20:09:19 get token failed: no metadata found for /home/rdupuis/go/src/github.com/kraust/cgo_gopls/cgo_gopls.go
2019/04/18 20:09:20 get token failed: no metadata found for /home/rdupuis/go/src/github.com/kraust/cgo_gopls/cgo_gopls.go

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.SuggestedIssues that may be good for new contributors looking for work to do.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions