Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A TextMate bundle for the Go programming language.
Ruby
Tree: 09df05843b

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Commands
Preferences
Snippets
Support
Syntaxes
.gitignore
History.rdoc
LICENSE
README.rdoc
info.plist

README.rdoc

Go

(a TextMate language bundle) Version 1.3

Installation

Ensure you've got a recent copy of git installed, then copy this line to your Terminal application and run it:

> curl -L github.com/downloads/AlanQuatermain/go-tmbundle/install-go-tmbundle.sh | sh

This project has been modified a little since it was first published. The original repository (no longer updated) is available at github.com/AlanQuatermain/old-go-tmbundle

Features

The bundle here implements a language syntax, some snippets, and some compile/format/documentation commands for the Go language (golang.org/). Much of the current infrastructure was created by Martin Kühl (github.com/mkhl), who is a significantly more seasoned TextMate bundle developer than I, and to whom I am eternally grateful.

Snippets

pkg

A package declaration including an optional comment block for packages other than 'main'.

imp

An import statement with optional alternative name.

imps

A multiple-import statement.

type

A type declaration, with name and variable type as tab-stops.

types

A block with multiple type declarations.

con

A single constant declaration.

cons

A multiple constant declaration block.

var

Declare a variable with an optional initial value (long form, i.e. 'var x int = 10').

vars

A block of long-form variable declarations.

func

A plain (global) function declaration, with tab stops for name, parameters, and a single optional result.

funcv

A plain (global) function declaration, with tab stops for name, parameters, and multiple results.

meth

Declares a function on a particular type, with additional tab stops for receiver name and type and a single optional result.

meth

Declares a function on a particular type, with additional tab stops for receiver name and type and multiple results.

in

An empty interface declaration (i.e. matches anything).

int

An interface definition with a single method.

st

A struct definition with a single member.

[]

A slice variable type; expands to '[]type', so is usable inside other snippets.

map

A map variable type; works similar to the slice type above.

ch

A channel type.

fun

A function type definition statement.

:

A short-form variable initializer (i.e. 'name := value').

mk

A make statement (used for creating & initializing channels, maps, etc.).

new

A new statement (used to create & initialize structure types).

Cmd-i

'iota'

if

An if statement, properly formatted (Go requires the use of {} on ifs, unlike C; this throws me sometimes).

sw

A switch statement with an optional expression.

sel

A select statement, for looping over channel conditions.

case

A case clause, within a switch or select.

def

A default clause within a switch.

for

A for loop.

fori

A for loop with an index (similar to C for loops).

forr

A for loop iterating over a collection's full range.

go

An immediate goroutine call (defines the function inline).

de

A deferred goroutine call (defines the function inline).

def

A simple deferred function call (by default supplies '+defer file.Close()+').

main

A template for a +main()+ function with a tab stop at its body.

init

A template for a module's +init()+ function, with a tab stop at its body.

,

A pair ('first, second'), suitable for declaring result variables from a multi-return-value function or a map range loop.

<

Send/receive through a channel. Provides tab stops for the value and the channel name.

ret

A return statement with optional return value.

Commands

Cmd-R

Compile and run the current file.

Cmd-B

Build the current project using gomake.

Cmd-Opt-B

Build the current project as a package using gomake & gopack.

Cmd-K

Compile the current file.

Ctrl-Shift-H

Reformat the document according to the Go style guidelines using gofmt.

Ctrl-H

Show the Go HTML documentation for the currently-selected symbol.

Thanks

Thanks be to lasersox and Infininight over at the #textmate room on IRC (irc://irc.freenode.net/textmate) for all their help in cleaning up this here bundle, and for helping me to optimize my regex use in the language grammar. Thanks to Martin Kühl for his extensive additions to this project's snippets and commands.

Contact Information

You can contact me through github, or you can ping me on Twitter as 'alanQuatermain'.

Happy coding :)

Something went wrong with that request. Please try again.