Skip to content
[
// ... (existing content)
// Add folder that contains current file to sidebar.
{ "keys": ["f3"], "command": "add_to_project" },
// ...
]
[
// ... (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"}

Compiling a Go project.

Conception-go $ go build
Conception-go $ 

Compiling a C++ project.

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).

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.

From http://golang.org/cmd/go/#hdr-GOPATH_environment_variable,

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.

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 {
package this_should_fail_to_compile_because_it_imports_nonexisting_package
import (
"fmt"
"net"
"github.com/samuel/go-zookeeper"
)
func main() {
<ul>
{{/* So simple... */}}
{{range .Cc.Commits}}<li>{{.Commit.Message}}</li>
{{end}}
{{/* 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>
{{end}}
</ul>

Code generated from protobufs:

public String getSomeId() {
    java.lang.Object ref = someId_;
    if (ref instanceof String) {
        return (String) ref;
    } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;

go get

  • Benchmark three ways to get/update (from scratch) the same 17 Go packages contained in a single git repo.
go get -d -u github.com/shurcooL/go/cmd/gocd
go get -d -u github.com/shurcooL/go/cmd/table
go get -d -u github.com/shurcooL/go/exp/11
go get -d -u github.com/shurcooL/go/exp/12
Something went wrong with that request. Please try again.