Skip to content
View gist:02183a57c51b28eaadf4
Last login: Tue Sep 29 09:25:27 on console
~ $ gocd
if $ go version
go version go1.5.1 darwin/amd64
if $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
if $ go run main.go 
View Default (OSX).sublime-keymap
// ... (existing content)
// Add folder that contains current file to sidebar.
{ "keys": ["f3"], "command": "add_to_project" },
// ...
View Default (OSX).sublime-keymap
// ... (existing content)
// Find selected text, even if it spans multiple lines (unlike "find_selected_text").
{ "keys": ["super+f"], "command": "run_multiple_commands", "args":
{ "commands":
// Only execute slurp if there's selected text.
{"command": "slurp_find_string", "context": "window", "condition": "selected_text"},
{"command": "show_panel", "args": {"panel": "find", "reverse": false}, "context": "window"}
View gist:86949a392dcdac1f94cf

Compiling a Go project.

Conception-go $ go build
Conception-go $ 

Compiling a C++ project.

View gist:6619001be6168d1abf66

go list tricks.

# Go package dependencies (all, recursive)
go list -f '{{join .Deps "\n"}}' ImportPath

# Go packages, command vs. library
go list -f '{{if eq .Name "main"}}/{{else}} {{end}} {{.ImportPath}}' all

# Find who imports "some/package" locally (including tests).
View gist:77cc54e53bbc0bf9a9a6

How I use GOPATH with multiple workspaces.

First off, I want to make it clear I have a fixed GOPATH that I do not change per project. The GOPATH env var is set inside my ~/.bash_profile file and doesn't change. Every Go package I have exists in no more than one place. I tend to have all my personal dependencies on latest version, simply because it's easier to have everything up to date than any alternative.

I do make use of the fact that the GOPATH environment variable is defined as a list of places rather than a single folder.


The GOPATH environment variable lists places to look for Go code. On Unix, the value is a colon-separated string. On Windows, the value is a semicolon-separated string. On Plan 9, the value is a list.

View gist:3f58c38dc262058c3e04

An example where var err error; something, err = foo() is nicer than something, err := foo().

This is a minority.

    fd := os.Stdout
    if *output != "" {
        var err error
        fd, err = os.Create(*output)
        if err != nil {
View main.go
package this_should_fail_to_compile_because_it_imports_nonexisting_package
import (
func main() {
View gist:5f9e93c38f6b75421060
{{/* So simple... */}}
{{range .Cc.Commits}}<li>{{.Commit.Message}}</li>
{{/* Is this really the shortest/best way to to do reverse range? */}}
{{range $i, $v := .Cc.Commits}}<li>{{(index $.Cc.Commits (revIndex $i (len $.Cc.Commits))).Commit.Message}}</li>
View gist:9f94bbd021b4693cf584

Code generated from protobufs:

public String getSomeId() {
    java.lang.Object ref = someId_;
    if (ref instanceof String) {
        return (String) ref;
    } else { bs = 
            ( ref;
Something went wrong with that request. Please try again.