Go-Sublime-build configuration

In ST3: it is changed to be:

{
    "shell_cmd": "go run ${file}"
}

Installing GoSublime should get this working for you. After installing and restarting ST2: do ctrl-B, type "run" and hit enter.


On my mac, I needed the following code in:

/Users/your_user_name/Library/Application Support/Sublime Text 2/Packages/User/go.sublime-build

go.sublime-build

{
    "cmd": ["go run '${file}'"],
    "selector": "source.go",
    "path": "/usr/local/go/bin",
    "shell": true
}  
  • "cmd" line quoting is to correctly handle file paths with spaces.
  • "shell" line is needed since commenting it out breaks it.
  • "path" line is needed because the basic shell, doesn't have access to my .zshrc file include the export GOPATH statement defining the go path.

After that any .go file should build and run with command+B, leaving the stdout message in a console built into sublime text 2.


I got by with

{
    "cmd": "go run $file",
    "shell" : true
}