Skip to content

Instantly share code, notes, and snippets.

@yukidarake
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukidarake/bc153dddbfc8896ac59f to your computer and use it in GitHub Desktop.
Save yukidarake/bc153dddbfc8896ac59f to your computer and use it in GitHub Desktop.

go oracle

何か?

The go oracle is a prototype source analysis tool that answers questions about Go programs.

エディタと統合するとJava書くときのEclipseばりの戦闘力になる。

何ができる?

  • callees 呼ぶ関数を表示
  • callers 呼び出し元を表示
  • callgraph コールグラフを表示
  • callstack コールスタックを表示
  • descrive 定義等表示
  • freevars 選択した範囲の変数の定義箇所を表示?
  • implements 実装しているインターフェースを表示
  • peers チャンネルの受信先/送信元を表示
  • referrers 変数を参照している箇所を表示

使い方

% go get code.google.com/p/go.tools/cmd/oracle
% oracle -pos=<File>#<Start>,#<End> -format=<Format> <Mode> <Scope>

※1 <Start> とか <End> はbyte数
※2 Vimの使いの方はg<C-G>で現在のカーソルまでのファイルのバイト数がわかる

oracle -pos=./main.go:#267 callees main.go
oracle -pos=./main.go:#267,#280 callgraph main.go

エディタとの統合

Vim

vim-go

GoImplements(実装されているインターフェースを表示)だけ使えるようになっている。
他のも使えたが、一旦外されたっぽい。

go-oracle.vim

微妙かも・・・

Emacs

2013/08時点では唯一使えるエディタだった模様。

Sublime TextとかAtom Editorは?

統合予定だがまだっぽい。

参考リンク

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment