goを1.7に上げてから、gocodeが動かなくなったりもしました

go1.6.2 -> go1.7でgocodeが動作しない

手元のmacの環境のgoを1.7に上げたところ、gocodeが上手く動作しなくなった。 (macportsを使っている)

$ sudo port selfupdate
$ sudo port upgrade go
$ go version
go version go1.7 darwin/amd64

以下の様な感じの出力を返す様になってしまった。

$ cat xxx.go | gocode -debug autocomplete /tmp/xxx/xxx.go c89
Found 1 candidates:
  PANIC PANIC PANIC

対応

以下を参考にして、gocodeをcloseした後、インストールしなおしたら直った。

$ gocode close
$ go get -u github.com/nsf/gocode

上手く動作している。

$ cat xxx.go | gocode -debug  autocomplete /tmp/xxx/xxx.go c89
Found 7 candidates:
  func Command(name string, arg ...string) *exec.Cmd
  func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd
  func LookPath(file string) (string, error)
  type Cmd struct
  type Error struct
  type ExitError struct
  var ErrNotFound error

memo

/tmp/xxx/xxx.go

package main

import (
    "os/exec"
)

// cancel by context

func main(){
    cmd := exec.//|ここにカーソル
}