Goguruは、Go Guruツールを統合するSublimetext 3のGolangプラグインです。
問題や改善は、https://github.com/alvarolm/goguru/issuesで報告してください
Waiganiの以前の研究に基づいています。
Guruツールはまだ開発中です。プラン、公式のGITリポジトリ、コードレビューをチェックしてください。
シンボル(関数、変数、定数など)を選択または配置し、 ctrl+shift+gを押します。以下の分析モードが表示されます。
callees show possible targets of selected function call
callers show possible callers of selected function
callstack show path from callgraph root to selected function
definition show declaration of selected identifier
describe describe selected syntax: definition, methods, etc
freevars show free variables of selection
implements show 'implements' relation for selected type or method
peers show send/receive corresponding to selected channel op
pointsto show variables the selected pointer may point to
referrers show all refs to entity denoted by selected identifier
what show basic information about the selected syntax node
whicherrs show possible values of the selected error variable
モードのいずれかを選択すると、出力が新しいタブに表示されます。結果のファイル名をダブルクリックして、直接ジャンプします。
また、 ctrlキーを保持し、シンボルright-clickて定義に右にジャンプすることもできます。
http://wbond.net/sublime_packages/package_controlから崇高なパッケージコントロール(まだ行っていない場合)をインストールします。 STを再起動して、インストールを完了してください。
コマンドパレット(デフォルトのCtrl+Shift+PまたはCMD+Shift+P)を表示し、パッケージコントロールの入力を開始します。パッケージをインストールしてから、そのオプションをクリックするかクリックしてアクティブ化します。利用可能なパッケージのリストに新しいクイックパネルが表示されます。 Goguruを入力し、Returnを押して、そのエントリでGoguruをインストールします。 Goguruのエントリがない場合は、おそらくすでにインストールされています。
Goguruには、機能するために設定するいくつかの変数があります。これらは、デフォルトのPreferences > Package Settings > GoGuru > Settings-Defaultのコメントで説明されています。
{
// use golangconfig, if false then shellenv will be used to get golang environment variables
"goguru_use_golangconfig" : false ,
// adds to the guru_scope the current package of the the working file
"goguru_use_current_package" : true ,
// besides showing the result, jump directly to the definition
"goguru_jumpto_definition" : false ,
// The output can either be one of: 'buffer', 'output_panel'
// Buffers can hold results from more than one invocation
// Output panels sit underneath the editor area and are easily dismissed
"goguru_output" : "output_panel" ,
// print debug info to the terminal
"goguru_debug" : false ,
// Set guru's output to json
"goguru_json" : false ,
// an array of scopes of analysis for guru.
// e.g (for github.com/juju/juju) "guru_scope": ["github.com/juju/juju/cmd/juju", "github.com/juju/juju/cmd/jujud"]
"goguru_scope" : [ ] ,
// an array of build tags of analyzed source files
"goguru_tags" : [ ] ,
// env overwrites the default shell environment vars
// e.g "env": { "GOPATH": "$HOME/go/bin:$PATH" }
// not used when goguru_use_golangconfig is set to true
"goguru_env" : { } ,
}独自の変数をPreferences > Package Settings > GoGuru > Settings-Userに設定します。
プロジェクト固有の設定を作成することもできます。まず、プロジェクトProject > Save as project ... 、プロジェクトProject > Edit Project 。以下は、github.com/juju/jujuコードベースで使用するGoguruを設定する例です。
{
"folders" :
[
{
"follow_symlinks" : true ,
"path" : "/home/user/go/src/github.com/juju/juju"
}
] ,
"settings" :
{
"GoGuru" : {
"goguru_scope" : [ "github.com/juju/juju/cmd/juju" , "github.com/juju/juju/cmd/jujud" ] ,
"goguru_output" : "output_panel"
}
} ,
}デフォルトのキーバインディング:
[
{ "keys" : [ "ctrl+shift+g" ] , "command" : "go_guru" } ,
{ "keys" : [ "ctrl+alt+shift+g" ] , "command" : "go_guru_show_results" } ,
{ "keys" : [ "ctrl+.+ctrl+g" ] , "command" : "go_guru_goto_definition" , "context" : [ { "key" : "selector" , "operator" : "equal" , "operand" : "source.go" } ] } ,
]上記をPreferences > Keybindings - Userにコピーし、Ctrl+Shift+Gを優先キーに置き換えることにより、独自のキーバインディングを設定できます。
また、「モード」argを追加することにより、特定のモードのキーバインディングを設定することもできます。
...
{ "keys" : [ "ctrl+super+c" ] , "command" : "go_guru" , "args" : { "mode" : "callers" } } ,
{ "keys" : [ "ctrl+super+i" ] , "command" : "go_guru" , "args" : { "mode" : "implements" } } ,
{ "keys" : [ "ctrl+super+r" ] , "command" : "go_guru" , "args" : { "mode" : "referrers" } } ,
{ "keys" : [ "ctrl+.+ctrl+g" ] , "command" : "go_guru" , "args" : { "mode" : "definition" , output = false } } ,
...デフォルトのマウスバインディング:
[
{
"button" : "button2" ,
"modifiers" : [ "ctrl" ] ,
"press_command" : "drag_select" ,
"command" : "go_guru" ,
"args" : {
"mode" : "definition" ,
"output" : false
} ,
} ,
] GoguruはGuruツールに依存しています。 Goguruが機能するためには、インストールする必要があります。コマンドラインで以下を実行します。
go install golang.org/x/tools/cmd/guru@latest
go get -u golang.org/x/tools/cmd/guru
GoguruはMITライセンスの下でリリースされます。 license.mdを参照してください
Goguruは、Goguruの著者Ie Me(Alvarolm)とすべての貢献者の著作権で保護された仕事です。 Goguruの歴史にコミットしている限り、ドキュメントであれコードであれ、変更を送信する場合、私はあなたを貢献者と考えています。すべてのGoguruの著者/貢献者のリストについては、authors.mdを参照してください。