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

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

Closed
Kraust opened this issue Apr 19, 2019 · 35 comments
Closed

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

Kraust opened this issue Apr 19, 2019 · 35 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@Kraust
Copy link

Kraust commented Apr 19, 2019

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

@gopherbot gopherbot added this to the Unreleased milestone Apr 19, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Apr 24, 2019
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 25, 2019
@wwcd
Copy link

wwcd commented Apr 28, 2019

Using pkg.GoFiles replace pkg.CompiledGoFiles? as CGO files is processed before compile.

It test work well.

https://github.com/golang/tools/blob/550556f78a900afacb9e8b22219f5e5b5c6106db/internal/lsp/cache/check.go#L151

@oakad
Copy link

oakad commented May 7, 2019

I can confirm that this happens with vscode-go as well. Given a file with any sort of cgo header:

package pack

/*
#include "some.h"
// more C
*/
import "C"

// Go code follows

gopls always returns "no file information" error:

[Error - 1:51:15 pm] Request textDocument/codeAction failed.
Message: no file information for file: file-with-cgo-header.go
Code: 0

And, of course, no code editing assist features are working in such files.

Other files in the very same package/project work just fine.

@joegrasse
Copy link

@stamblerre is there a downside to the workaround that @wwcd suggests above?

@stamblerre
Copy link
Contributor

Sorry for my delayed response on this issue. We are still trying to figure out the right way to handle cgo. Unfortunately, @wwcd's suggestion won't work for us. We have to use CompiledGoFiles because those are the actual files we need to build a package.

We probably won't have a meaningful solution for autocompletion and other language features in cgo files, but as a start @ianthehat and I have discussed simply disabling diagnostics for all generated files.

@joegrasse
Copy link

We probably won't have a meaningful solution for autocompletion and other language features in cgo files, but as a start @ianthehat and I have discussed simply disabling diagnostics for all generated files.

@stamblerre In this case, would I still get autocompletion of Go stuff just not C stuff in a file with C and Go? If so, I would be OK with that.

@joegrasse
Copy link

@stamblerre Just curious on an answer to the above question.

@wubo0067
Copy link

the https://github.com/cri-o/cri-o.git use cgo, Causes Gopls not to work, no prompts

@gopherbot
Copy link

Change https://golang.org/cl/181546 mentions this issue: internal/lsp: stop requiring a .go extension for all Go files

gopherbot pushed a commit to golang/tools that referenced this issue Jun 11, 2019
This change should fix the TryBot failures exposed by
https://golang.org/cl/181317.

Updates golang/go#31561

Change-Id: Ie77c9e3bfd6825dcd2608523e72f804f81d3f48c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/181546
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
@ericm
Copy link

ericm commented Jun 15, 2019

I have the same issue with gopls and cgo using coc.nvim.

[coc.nvim] Error output from languageserver.golang: 
unable to check package for file:///home/eric/forks/goncurses/defs.go: 
loadParseTypecheck: no metadata found for /home/eric/forks/goncurses/defs.go[coc.nvim] 
Error output from languageserver.golang: no package available for file:///home/eric/forks/goncurses/defs.go

@Kraust
Copy link
Author

Kraust commented Jul 2, 2019

Things look to be working much more better now and I am not seeing gopls crashes when it cannot find references generated from cgo, this issue can be closed.

@Kraust Kraust closed this as completed Jul 2, 2019
@joegrasse
Copy link

I seem to still be having the same problems. Was there an update that should have fixed this issue?

@stamblerre
Copy link
Contributor

Re-opening this issue because we still need to do a better job supporting cgo in gopls, but thank you for updating this, @Kraust!

@joegrasse: gopls on the latest master (go get -u golang.org/x/tools/gopls@master) should handle cgo ok - you just won't get autocomplete or other language features for any of the C symbols (but you will for other symbols).

@stamblerre stamblerre reopened this Jul 2, 2019
@joegrasse
Copy link

@stamblerre Would go get -u golang.org/x/tools/gopls get the most recent version? I get errors when trying to do go get -u golang.org/x/tools/gopls@master.

@stamblerre
Copy link
Contributor

stamblerre commented Jul 2, 2019

@joegrasse: What errors do you see? go get golang.org/x/tools/gopls@latest will get you the latest tagged version, which I think should also be fine with cgo.

Edit: Remove -u.

@stamblerre stamblerre changed the title x/tools/cmd/gopls: gopls does not work with cgo x/tools/gopls: gopls does not work with cgo Jul 2, 2019
@joegrasse
Copy link

Here is the error I am getting.

Getting: golang.org/x/tools/gopls@master
Error: Get Failed: go: finding golang.org/x/tools/gopls master
go: finding golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0
go: golang.org/x/tools@v0.0.0-20190628153133-6cdbf07be9d0: git -c protocol.version=0 fetch --unshallow -f https://go.googlesource.com/tools refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /usr2/ps/isp/go/pkg/mod/cache/vcs/b44680b3c3708a854d4c89f55aedda0b223beb8d9e30fba969cefb5bd9c1e843: exit status 129:
        error: unknown option `unshallow'
        usage: git fetch [<options>] [<repository> [<refspec>...]]
           or: git fetch [<options>] <group>
           or: git fetch --multiple [<options>] [(<repository> | <group>)...]
           or: git fetch --all [<options>]

            -v, --verbose         be more verbose
            -q, --quiet           be more quiet
            --all                 fetch from all remotes
            -a, --append          append to .git/FETCH_HEAD instead of overwriting
            --upload-pack <path>  path to upload pack on remote end
            -f, --force           force overwrite of local branch
            -m, --multiple        fetch from multiple remotes
            -t, --tags            fetch all tags and associated objects
            -n                    do not fetch all tags (--no-tags)
            -p, --prune           prune remote-tracking branches no longer on remote
            --recurse-submodules[=<on-demand>]
                                  control recursive fetching of submodules
            --dry-run             dry run
            -k, --keep            keep downloaded pack
            -u, --update-head-ok  allow updating of HEAD ref
            --progress            force progress reporting
            --depth <depth>       deepen history of shallow clone
go: error loading module requirements

@stamblerre
Copy link
Contributor

Are you able to get the version with the latest tag?

@joegrasse
Copy link

Same error. Looks like the version of git on CentOS 6 doesn't support the unshallow option.

@stamblerre
Copy link
Contributor

Ok, sounds like this is an issue with the go command and the minimum version requirements for git. Can you open a separate issue with the information you have provided here?

Closing this issue. Filed #32898 for cgo-related issues.

@joegrasse
Copy link

Back to the cgo issue, I believe I have the most up-to-date version of golang.org/x/tools and golang.org/x/tools/gopls (comparing commits local to remote) and I still don't get autocomplete information for symbols that are not C.

To clarify, within the same project, I can get autocomplete information for a source file that is pure Go, but not on a file that does import "C".

@stamblerre
Copy link
Contributor

Can you confirm your version with gopls version?

@joegrasse
Copy link

Here is the output from gopls version.
version v0.1.1, built in $GOPATH mode

@stamblerre
Copy link
Contributor

Are you able to share gopls logs? (In VSCode, View: Debug Console -> Output -> Tasks -> gopls). Note that we have not invested much time in supporting cgo, so it may be the case that some files that import C will simply not have language features for now. However, I was able to get language features in a file that imported C when I tested with a small example.

@joegrasse
Copy link

Yes, I can share logs, but I am using vim.

@stamblerre
Copy link
Contributor

stamblerre commented Jul 2, 2019

For other editors, you will need to pass in -rpc.trace -logfile=/path/to/logfile as flags to gopls.

@joegrasse
Copy link

Here is what I could get.

  • daemon-example.go does an import "C"
  • signals.go doesn't

They are both in the same package.

Log Output

@stamblerre
Copy link
Contributor

It seems like gopls isn't able to get the package metadata for daemon-example.go. Does removing import "C" fix the problem? What is the output of go list -e -json -compiled -test /usr2/ps/baseline.mount/isp.src/gosrc/private.url.com/ext/daemon-example/?

@suizman
Copy link

suizman commented Jul 5, 2019

It seems like gopls isn't able to get the package metadata for daemon-example.go. Does removing import "C" fix the problem? What is the output of go list -e -json -compiled -test /usr2/ps/baseline.mount/isp.src/gosrc/private.url.com/ext/daemon-example/?

I have the exact same problem in my project using import "C". Removing the import line fixes the gopls problem but of course i'm unable to build without using the C bindings package.

go list -e -json -compiled -test rocksdb/db.go

@joegrasse
Copy link

Here is the output you requested.

go list -e -json -compiled -test /usr2/ps/baseline.mount/isp.src/gosrc/private.url.com/ext/daemon-example/
{
        "Dir": "/usr2/ps/isp/go/src/private.url.com/ext/daemon-example",
        "ImportPath": "private.url.com/ext/daemon-example",
        "Name": "main",
        "Doc": "Command daemon-example is a basic example of a Go program interfacing with the PIM C code.",
        "Target": "/usr2/ps/isp/go/bin/daemon-example",
        "Root": "/usr2/ps/isp/go",
        "Match": [
                "/usr2/ps/baseline.mount/isp.src/gosrc/private.url.com/ext/daemon-example"
        ],
        "GoFiles": [
                "signals.go"
        ],
        "CgoFiles": [
                "build_dev_386.go",
                "daemon-example.go"
        ],
        "CompiledGoFiles": [
                "signals.go",
                "/usr2/shared/graj04/.cache/go-build/12/12a0df01d2653f3fdf63b149a9ab198d22bcc6bc35091bd1e59818918016703a-d",
                "/usr2/shared/graj04/.cache/go-build/92/923c6c623035425c055bacd76564b9668260819645ecda973baf6e31b43a15da-d",
                "/usr2/shared/graj04/.cache/go-build/60/606a12f8b205cde299956cb497b55d1ad282e99adb31eac014a738206463f65e-d",
                "/usr2/shared/graj04/.cache/go-build/34/3414d2cd2f62ddebbc12451972710640fc0a183272686838bc1a242649260ce0-d"
        ],
        "IgnoredGoFiles": [
                "build_dev_amd64.go",
                "build_prod_386.go",
                "build_prod_amd64.go"
        ],
        "CgoCFLAGS": [
                "-I/usr2/ps/isp/include/sys",
                "-I/usr2/ps/isp/src/sys",
                "-I/usr2/ps/3rdParty/libunwind/libunwind-current_i686/include"
        ],
        "CgoLDFLAGS": [
                "-L/usr2/ps/isp/lib",
                "-lps",
                "-L/usr2/ps/3rdParty/libunwind/libunwind-current_i686/lib",
                "-l:libunwind.a"
        ],
        "Imports": [
                "C",
                "flag",
                "fmt",
                "private.url.com/lib/platform/genlog",
                "os",
                "os/signal",
                "runtime",
                "runtime/debug",
                "sync",
                "syscall",
                "time",
                "unsafe",
                "runtime/cgo"
        ],
        "Deps": [
                "bytes",
                "errors",
                "flag",
                "fmt",
                "private.url.com/lib/platform/genlog",
                "internal/bytealg",
                "internal/cpu",
                "internal/fmtsort",
                "internal/poll",
                "internal/race",
                "internal/syscall/unix",
                "internal/testlog",
                "io",
                "math",
                "math/bits",
                "os",
                "os/signal",
                "reflect",
                "regexp",
                "regexp/syntax",
                "runtime",
                "runtime/cgo",
                "runtime/debug",
                "runtime/internal/atomic",
                "runtime/internal/math",
                "runtime/internal/sys",
                "sort",
                "strconv",
                "strings",
                "sync",
                "sync/atomic",
                "syscall",
                "time",
                "unicode",
                "unicode/utf8",
                "unsafe"
        ]
}

@joegrasse
Copy link

Also just as @suizman, if I comment out import "C" it works.

@stamblerre
Copy link
Contributor

Thanks for the reports. Re-opening this issue so that I add some tests for cgo and investigate this further.

@stamblerre stamblerre reopened this Jul 8, 2019
@stamblerre stamblerre changed the title x/tools/gopls: gopls does not work with cgo x/tools/gopls: add tests for cgo Jul 8, 2019
@ogimenezb
Copy link

Hi,

Have the same problem, here are the logs:

Log gopls
[Info  - 20:16:09] Build info
----------
golang.org/x/tools/gopls v0.1.1
    golang.org/x/tools/gopls@v0.1.2-0.20190708203411-c8855242db9c h1:qFHl9H1pFOvam5c7rRNiSVPuASu5sS/VNZUj7KNAyGI=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20190708203411-c8855242db9c h1:rRFNgkkT7zOyWlroLBmsrKYtBNhox8WtulQlOr3jIDk=

Go info
-------
go version go1.12.6 windows/amd64

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\oscar\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\oscar\go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=c:\data\daemez.io\x\idManager\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=C:\Users\oscar\AppData\Local\Temp\go-build392406622=/tmp/go-build -gno-record-gcc-switches

[Error - 20:16:11] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:12] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:13] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:14] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:14] Request textDocument/documentSymbol failed.
  Message: no AST for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go
  Code: 0 
[Error - 20:16:15] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:16] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:17] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:17] Request textDocument/codeAction failed.
  Message: no package for file file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go
  Code: 0 
[Error - 20:16:18] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:18] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:18] Request textDocument/documentLink failed.
  Message: no AST for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go
  Code: 0 
[Error - 20:16:19] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:20] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:21] unable to check package for file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go: loadParseTypecheck: no metadata found for c:\data\daemez.io\x\idManager\pkg\devices\scanners\ib\ib.go
[Error - 20:16:21] Request textDocument/codeAction failed.
  Message: no package for file file:///c:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/ib.go
  Code: 0 

go list -e -json -compiled -test
$ go list -e -json -compiled -test /c/data/daemez.io/x/idManager/pkg/devices/scanners/ib/
{
        "Dir": "C:\\data\\daemez.io\\x\\idManager\\pkg\\devices\\scanners\\ib",
        "ImportPath": "daemez.io/x/idManager/pkg/devices/scanners/ib",
        "Name": "ib",
        "Module": {
                "Path": "daemez.io/x/idManager",
                "Main": true,
                "Dir": "C:\\data\\daemez.io\\x\\idManager",
                "GoMod": "C:\\data\\daemez.io\\x\\idManager\\go.mod"
        },
        "Match": [
                "C:/data/daemez.io/x/idManager/pkg/devices/scanners/ib"
        ],
        "Stale": true,
        "StaleReason": "not installed but available in build cache",
        "CgoFiles": [
                "const.go",
                "ib.go"
        ],
        "CompiledGoFiles": [
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\b4\\b4cc4056640a3b3e978a7b59cfee3f7bac6ff0b74acf950e0bc98af995fad3c3-d",
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\c6\\c64d6bf1a1cf053149fe88b1629be7d6f1549c92b02c7ff37feca2e55df48a29-d",
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\32\\324034aed12543da2181bdfca4426f0b05c2b87ccfc373503871869807f698d9-d",
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\8d\\8dd51ee05ecf23ce4cdebf7bfbb58b04d5103a56af995fa5a7031fe56b705aaf-d"
        ],
        "CgoCFLAGS": [
                "-std=gnu99",
                "-IC:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/../../../../third_party/sdk/include/integratedbiometrics",
                "-std=gnu99",
                "-IC:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/../../../../third_party/sdk/include/integratedbiometrics"
        ],
        "CgoLDFLAGS": [
                "-LC:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/../../../../third_party/sdk/bin/win64_x64",
                "-lIBScanUltimate"
        ],
        "Imports": [
                "C",
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/plugins",
                "fmt",
                "github.com/gofrs/uuid",
                "github.com/pkg/errors",
                "github.com/sirupsen/logrus",
                "os",
                "runtime",
                "strconv",
                "sync",
                "time",
                "unsafe",
                "runtime/cgo",
                "syscall",
                "unsafe",
                "runtime/cgo",
                "syscall"
        ],
        "Deps": [
                "bufio",
                "bytes",
                "context",
                "crypto",
                "crypto/md5",
                "crypto/rand",
                "crypto/sha1",
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/plugins",
                "database/sql/driver",
                "encoding",
                "encoding/base64",
                "encoding/binary",
                "encoding/hex",
                "encoding/json",
                "errors",
                "fmt",
                "github.com/gofrs/uuid",
                "github.com/golang/protobuf/proto",
                "github.com/golang/protobuf/protoc-gen-go/descriptor",
                "github.com/golang/protobuf/ptypes/any",
                "github.com/golang/protobuf/ptypes/timestamp",
                "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options",
                "github.com/konsorten/go-windows-terminal-sequences",
                "github.com/pkg/errors",
                "github.com/sirupsen/logrus",
                "hash",
                "internal/bytealg",
                "internal/cpu",
                "internal/fmtsort",
                "internal/nettrace",
                "internal/poll",
                "internal/race",
                "internal/singleflight",
                "internal/syscall/windows",
                "internal/syscall/windows/registry",
                "internal/syscall/windows/sysdll",
                "internal/testlog",
                "internal/x/net/dns/dnsmessage",
                "io",
                "log",
                "math",
                "math/big",
                "math/bits",
                "math/rand",
                "net",
                "os",
                "path",
                "reflect",
                "runtime",
                "runtime/cgo",
                "runtime/internal/atomic",
                "runtime/internal/math",
                "runtime/internal/sys",
                "sort",
                "strconv",
                "strings",
                "sync",
                "sync/atomic",
                "syscall",
                "time",
                "unicode",
                "unicode/utf16",
                "unicode/utf8",
                "unsafe"
        ],
        "XTestGoFiles": [
                "ib_test.go"
        ],
        "XTestImports": [
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/devices/scanners/ib",
                "os",
                "reflect",
                "sync",
                "testing",
                "time"
        ]
}
{
        "Dir": "C:\\data\\daemez.io\\x\\idManager\\pkg\\devices\\scanners\\ib",
        "ImportPath": "daemez.io/x/idManager/pkg/devices/scanners/ib.test",
        "Name": "main",
        "Stale": true,
        "StaleReason": "stale dependency: daemez.io/x/idManager/model",
        "GoFiles": [
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\64\\64d699c695c09230194c89362a2dfaf17b99052aa22bb36e920574b95a9d3e2c-d"
        ],
        "CompiledGoFiles": [
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\64\\64d699c695c09230194c89362a2dfaf17b99052aa22bb36e920574b95a9d3e2c-d"
        ],
        "Imports": [
                "daemez.io/x/idManager/pkg/devices/scanners/ib",
                "daemez.io/x/idManager/pkg/devices/scanners/ib_test [daemez.io/x/idManager/pkg/devices/scanners/ib.test]",
                "os",
                "testing",
                "testing/internal/testdeps"
        ],
        "ImportMap": {
                "daemez.io/x/idManager/pkg/devices/scanners/ib_test": "daemez.io/x/idManager/pkg/devices/scanners/ib_test [daemez.io/x/idManager/pkg/devices/scanners/ib.test]"
        },
        "Deps": [
                "bufio",
                "bytes",
                "compress/flate",
                "compress/gzip",
                "context",
                "crypto",
                "crypto/md5",
                "crypto/rand",
                "crypto/sha1",
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/devices/scanners/ib",
                "daemez.io/x/idManager/pkg/devices/scanners/ib_test [daemez.io/x/idManager/pkg/devices/scanners/ib.test]",
                "daemez.io/x/idManager/pkg/plugins",
                "database/sql/driver",
                "encoding",
                "encoding/base64",
                "encoding/binary",
                "encoding/hex",
                "encoding/json",
                "errors",
                "flag",
                "fmt",
                "github.com/gofrs/uuid",
                "github.com/golang/protobuf/proto",
                "github.com/golang/protobuf/protoc-gen-go/descriptor",
                "github.com/golang/protobuf/ptypes/any",
                "github.com/golang/protobuf/ptypes/timestamp",
                "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options",
                "github.com/konsorten/go-windows-terminal-sequences",
                "github.com/pkg/errors",
                "github.com/sirupsen/logrus",
                "hash",
                "hash/crc32",
                "internal/bytealg",
                "internal/cpu",
                "internal/fmtsort",
                "internal/nettrace",
                "internal/poll",
                "internal/race",
                "internal/singleflight",
                "internal/syscall/windows",
                "internal/syscall/windows/registry",
                "internal/syscall/windows/sysdll",
                "internal/testlog",
                "internal/x/net/dns/dnsmessage",
                "io",
                "io/ioutil",
                "log",
                "math",
                "math/big",
                "math/bits",
                "math/rand",
                "net",
                "os",
                "path",
                "path/filepath",
                "reflect",
                "regexp",
                "regexp/syntax",
                "runtime",
                "runtime/cgo",
                "runtime/debug",
                "runtime/internal/atomic",
                "runtime/internal/math",
                "runtime/internal/sys",
                "runtime/pprof",
                "runtime/trace",
                "sort",
                "strconv",
                "strings",
                "sync",
                "sync/atomic",
                "syscall",
                "testing",
                "testing/internal/testdeps",
                "text/tabwriter",
                "time",
                "unicode",
                "unicode/utf16",
                "unicode/utf8",
                "unsafe"
        ]
}
{
        "Dir": "C:\\data\\daemez.io\\x\\idManager\\pkg\\devices\\scanners\\ib",
        "ImportPath": "daemez.io/x/idManager/pkg/devices/scanners/ib",
        "Name": "ib",
        "Module": {
                "Path": "daemez.io/x/idManager",
                "Main": true,
                "Dir": "C:\\data\\daemez.io\\x\\idManager",
                "GoMod": "C:\\data\\daemez.io\\x\\idManager\\go.mod"
        },
        "Match": [
                "C:/data/daemez.io/x/idManager/pkg/devices/scanners/ib"
        ],
        "Stale": true,
        "StaleReason": "not installed but available in build cache",
        "CgoFiles": [
                "const.go",
                "ib.go"
        ],
        "CompiledGoFiles": [
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\b4\\b4cc4056640a3b3e978a7b59cfee3f7bac6ff0b74acf950e0bc98af995fad3c3-d",
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\c6\\c64d6bf1a1cf053149fe88b1629be7d6f1549c92b02c7ff37feca2e55df48a29-d",
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\32\\324034aed12543da2181bdfca4426f0b05c2b87ccfc373503871869807f698d9-d",
                "C:\\Users\\oscar\\AppData\\Local\\go-build\\8d\\8dd51ee05ecf23ce4cdebf7bfbb58b04d5103a56af995fa5a7031fe56b705aaf-d"
        ],
        "CgoCFLAGS": [
                "-std=gnu99",
                "-IC:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/../../../../third_party/sdk/include/integratedbiometrics",
                "-std=gnu99",
                "-IC:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/../../../../third_party/sdk/include/integratedbiometrics"
        ],
        "CgoLDFLAGS": [
                "-LC:/data/daemez.io/x/idManager/pkg/devices/scanners/ib/../../../../third_party/sdk/bin/win64_x64",
                "-lIBScanUltimate"
        ],
        "Imports": [
                "C",
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/plugins",
                "fmt",
                "github.com/gofrs/uuid",
                "github.com/pkg/errors",
                "github.com/sirupsen/logrus",
                "os",
                "runtime",
                "strconv",
                "sync",
                "time",
                "unsafe",
                "runtime/cgo",
                "syscall",
                "unsafe",
                "runtime/cgo",
                "syscall"
        ],
        "Deps": [
                "bufio",
                "bytes",
                "context",
                "crypto",
                "crypto/md5",
                "crypto/rand",
                "crypto/sha1",
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/plugins",
                "database/sql/driver",
                "encoding",
                "encoding/base64",
                "encoding/binary",
                "encoding/hex",
                "encoding/json",
                "errors",
                "fmt",
                "github.com/gofrs/uuid",
                "github.com/golang/protobuf/proto",
                "github.com/golang/protobuf/protoc-gen-go/descriptor",
                "github.com/golang/protobuf/ptypes/any",
                "github.com/golang/protobuf/ptypes/timestamp",
                "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options",
                "github.com/konsorten/go-windows-terminal-sequences",
                "github.com/pkg/errors",
                "github.com/sirupsen/logrus",
                "hash",
                "internal/bytealg",
                "internal/cpu",
                "internal/fmtsort",
                "internal/nettrace",
                "internal/poll",
                "internal/race",
                "internal/singleflight",
                "internal/syscall/windows",
                "internal/syscall/windows/registry",
                "internal/syscall/windows/sysdll",
                "internal/testlog",
                "internal/x/net/dns/dnsmessage",
                "io",
                "log",
                "math",
                "math/big",
                "math/bits",
                "math/rand",
                "net",
                "os",
                "path",
                "reflect",
                "runtime",
                "runtime/cgo",
                "runtime/internal/atomic",
                "runtime/internal/math",
                "runtime/internal/sys",
                "sort",
                "strconv",
                "strings",
                "sync",
                "sync/atomic",
                "syscall",
                "time",
                "unicode",
                "unicode/utf16",
                "unicode/utf8",
                "unsafe"
        ],
        "XTestGoFiles": [
                "ib_test.go"
        ],
        "XTestImports": [
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/devices/scanners/ib",
                "os",
                "reflect",
                "sync",
                "testing",
                "time"
        ]
}
{
        "Dir": "C:\\data\\daemez.io\\x\\idManager\\pkg\\devices\\scanners\\ib",
        "ImportPath": "daemez.io/x/idManager/pkg/devices/scanners/ib_test [daemez.io/x/idManager/pkg/devices/scanners/ib.test]",
        "Name": "ib_test",
        "ForTest": "daemez.io/x/idManager/pkg/devices/scanners/ib",
        "Stale": true,
        "StaleReason": "stale dependency: daemez.io/x/idManager/model",
        "GoFiles": [
                "ib_test.go"
        ],
        "CompiledGoFiles": [
                "ib_test.go"
        ],
        "Imports": [
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/devices/scanners/ib",
                "os",
                "reflect",
                "sync",
                "testing",
                "time"
        ],
        "Deps": [
                "bufio",
                "bytes",
                "context",
                "crypto",
                "crypto/md5",
                "crypto/rand",
                "crypto/sha1",
                "daemez.io/x/idManager/model",
                "daemez.io/x/idManager/pkg/devices",
                "daemez.io/x/idManager/pkg/devices/scanners/ib",
                "daemez.io/x/idManager/pkg/plugins",
                "database/sql/driver",
                "encoding",
                "encoding/base64",
                "encoding/binary",
                "encoding/hex",
                "encoding/json",
                "errors",
                "flag",
                "fmt",
                "github.com/gofrs/uuid",
                "github.com/golang/protobuf/proto",
                "github.com/golang/protobuf/protoc-gen-go/descriptor",
                "github.com/golang/protobuf/ptypes/any",
                "github.com/golang/protobuf/ptypes/timestamp",
                "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options",
                "github.com/konsorten/go-windows-terminal-sequences",
                "github.com/pkg/errors",
                "github.com/sirupsen/logrus",
                "hash",
                "internal/bytealg",
                "internal/cpu",
                "internal/fmtsort",
                "internal/nettrace",
                "internal/poll",
                "internal/race",
                "internal/singleflight",
                "internal/syscall/windows",
                "internal/syscall/windows/registry",
                "internal/syscall/windows/sysdll",
                "internal/testlog",
                "internal/x/net/dns/dnsmessage",
                "io",
                "log",
                "math",
                "math/big",
                "math/bits",
                "math/rand",
                "net",
                "os",
                "path",
                "reflect",
                "runtime",
                "runtime/cgo",
                "runtime/debug",
                "runtime/internal/atomic",
                "runtime/internal/math",
                "runtime/internal/sys",
                "runtime/trace",
                "sort",
                "strconv",
                "strings",
                "sync",
                "sync/atomic",
                "syscall",
                "testing",
                "time",
                "unicode",
                "unicode/utf16",
                "unicode/utf8",
                "unsafe"
        ]
}

Hope this can help, let me know if you need anything else.

Thanks!

@stamblerre stamblerre added the Suggested Issues that may be good for new contributors looking for work to do. label Jul 10, 2019
@stamblerre
Copy link
Contributor

Duplicate of #32898

@stamblerre stamblerre marked this as a duplicate of #32898 Aug 5, 2019
@joegrasse
Copy link

@stamblerre I don't believe this is a duplicate of #32898. At least not the way it is described in that issue. In #32898 gopls doesn't work with symbols imported from "C". The problem I (and I believe others) have had and described in this issue is that symbols imported from say "fmt" don't work in files that also import "C".

@stamblerre
Copy link
Contributor

@joegrasse: In general, gopls doesn't have good support for cgo, so I will track improving cgo support in #32898. That could include both of the issues that you mentioned.

@ianthehat
Copy link

also note that files that import "C" are not true go files, they are cgo files that have to be translated before they become go files, which means they are not in the set of files presented to the go compiler (which are the same set of files that we can typecheck correctly).
You can see the evidence of this in the go list output (the original files appear in the CgoFiles list, and the CompiledGoFiles has some weird names from the build cache)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests