gocode icon indicating copy to clipboard operation
gocode copied to clipboard

Setting GOARCH

Open jonbonazza opened this issue 8 years ago • 3 comments

I am using gocode in vscode and I am trying to build a CGO project that requires GOARCH=386. I cannot for the life of me figure out how to tell gocode to use this GOARCH.

No matter what I try, I get:

2017/05/28 23:44:22 Gocode's build context is:
2017/05/28 23:44:22  GOROOT: C:\Go\
2017/05/28 23:44:22  GOPATH: C:\GoProjects
2017/05/28 23:44:22  GOOS: windows
2017/05/28 23:44:22  GOARCH: amd64
2017/05/28 23:44:22  BzlProjectRoot: ""
2017/05/28 23:44:22  GBProjectRoot: ""
2017/05/28 23:44:22  lib-path: ""
2017/05/28 23:44:22 extracted expression tokens: window
2017/05/28 23:44:22 Offset: 0
2017/05/28 23:44:22 Number of candidates found: 0
2017/05/28 23:44:22 Candidates are:

jonbonazza avatar May 29 '17 06:05 jonbonazza

Gocode passes environment variables from a client to a server. You should set in on whoever invokes the client and hope that it passes env vars to gocode. In your case that would be vscode, have no idea how it invokes gocode.

nsf avatar May 29 '17 06:05 nsf

I guess it works through https://marketplace.visualstudio.com/items?itemName=lukehoban.Go

kovetskiy avatar May 29 '17 09:05 kovetskiy

BTW vscode-go unsets GOARCH env: https://github.com/Microsoft/vscode-go/blob/bca4dd5f31f32ac49da79580c07b4000f06287a3/src/goSuggest.ts#L129-L132

kovetskiy avatar May 29 '17 09:05 kovetskiy