Skip to content

Choose GOROOT before GOPATH when selecting libraries #2839

@siennathesane

Description

@siennathesane
  • Plugin version (or commit hash): 0.13.1914

  • IDE name and version: PyCharm 2016.3

  • Java version: Built-in

  • OS name and version: Windows 10 x64

  • What are you trying to do?

Call a standard library and have the plugin autodetect which to import. In this case, I typed runtime.GOOS and let the plugin add the import.

  • What would you expect to happen?

The plugin would add "runtime" from the GOROOT standard library, not my GOPATH.

  • What happens?

Because I have the core Go language (and lots of it's ecosystem) imported into my GOPATH (for language development), I can recursively import my local Go implementation. So when I typed runtime.GOOS, the plugin defaulted and imported "github.com/golang/go/src/pkg/runtime". I didn't notice it (off screen import) first, and when I went to compile it, it threw this error on Windows:

>go build
utils\log.go:13:2: C source files not allowed when not using cgo or SWIG: alg.c atomic_amd64.c callback_windows_amd64.c
cgocall.c chan.c closure_amd64.c complex.c cpuprof.c float.c hashmap.c iface.c lock_sema.c mcache.c mcentral.c mem_windo
ws.c mfinal.c mfixalloc.c mgc0.c mheap.c msize.c print.c proc.c rune.c runtime.c signal_windows_amd64.c slice.c symtab.c
 thread_windows.c traceback_x86.c

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions