• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    Ruby
  • License
    Other
  • Created about 15 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A TextMate bundle for the Go programming language.

Go

(a TextMate 2 language bundle) Version 2.0.1

Installation

The easiest way to install this bundle is to let TextMate 2 do the work for you: create a new .go file and open it in TextMate. The application will then suggest the Go language format and will download and install the bundle for you.

If you’d rather do things manually, or if you want to make changes to the repository, then in a Terminal window do:

mkdir ~/Library/Application\ Support/Avian/Bundles
cd ~/Library/Application\ Support/Avian/Bundles
git clone git://github.com/AlanQuatermain/go-tmbundle.git 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.

Support for Go 1.0 was provided by Jeremy Whitlock (github.com/whitlockjc) and Michael Sheets (github.com/infininight), with additional code and fixes from Sylvain Defresne (github.com/sdefresne), liuyork (github.com/liuyork), and Alexey Palazhchenko (github.com/AlekSi).

Snippets

Simple Statements

Cmd-i

iota

,

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.

def

A default clause within a switch.

in

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

imp

An import statement with optional alternative name.

imps

A multiple-import statement.

pkg

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

ret

A return statement with optional return value.

Initializers and Declarations

:

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

[]

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

ch

A channel type.

con

A single constant declaration.

cons

A multiple constant declaration block.

fun

A function type definition statement.

int

An interface definition with a single method.

mk

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

map

A map variable type; expands to ‘map[keytype]valuetype’.

new

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

st

A struct definition with a single member.

type

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

types

A block with multiple type declarations.

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.

Functions

de

A deferred goroutine call (defines the function inline).

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.

go

An immediate goroutine call (defines the function inline).

init

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

main

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

meth

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

methv

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

Control Statements

case

A case clause, within a switch or select.

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.

if

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

sel

A select statement, for looping over channel conditions.

sw

A switch statement with an optional expression.

Commands

Cmd-K

Build the current package or executable.

Cmd-R

Compile and run the current file.

Cmd-Opt-T

Launch the unittests for the current package using “go test”.

Ctrl-Shift-H

Reformat the document according to the Go style guidelines.

Ctrl-H

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

<ESC>

Complete the symbol under the cursor.

Thanks

Thanks be to lasersox and Infininight over at the #textmate room on 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. Also Infininight’s work on updating the bundle to use the TextMate’s new Ruby interface and Jeremy & Sylvain’s work on supporting Go 1.0 has been invaluable. Their assistance and stewardship while I’ve been deep in the world of Objective-C is very much appreciated.

Contact Information

You can contact me through github, or you can ping me on Twitter or alpha.app.net as ‘alanQuatermain’.

Happy coding :)

More Repositories

1

AQGridView

A grid view for iPhone/iPad, designed to look similar to NSCollectionView.
Objective-C
2,379
star
2

aqtoolkit

A toolkit consisting of a bunch of generally useful routines and extensions I wrote when putting together other projects.
Objective-C
787
star
3

iPhoneContacts

A wrapper for the iPhone's C-based AddressBook framework.
Objective-C
228
star
4

AQUI

A collection of SwiftUI views and utilities.
Swift
167
star
5

mac-app-store-validation-sample

An example of a working app store validation, with code signing checks.
C
107
star
6

SimpleHTTPServer

A simple HTTP server, implemented as a Mac command-line application. The source code, aside from main.m, is designed to work on either Mac or iOS.
Objective-C
89
star
7

AQAppStateMachine

An application state machine, based on matching values within bitfields to trigger actions supplied using Blocks.
Objective-C
87
star
8

iPad-Filesystem

A simple split-view-based filesystem browser for the iPad. Find out what you can read or write!
Objective-C
57
star
9

AQSocket

Trying out some asynchronous socket-level APIs using dispatch IO on iOS 5.
Objective-C
46
star
10

appencryptor

A command-line tool to apply or remove Apple Binary Protection from an application.
C
46
star
11

AQSelfRotatingViewController

A UIViewController subclass which implements its own auto-rotation logic, so its view can be placed directly into a UIWindow above other views.
Objective-C
39
star
12

GlassButton

A simple glass-effect UIButton subclass. It supports tinting although not brilliantly (it doesn't modify brightnesses). For best results, leave it alone for a slightly-smoked glass effect.
Objective-C
34
star
13

SwiftUIShareSheetDemo

A demonstration of how to display a share sheet in a SwiftUI application.
Swift
28
star
14

unirast

An attempt to reverse-engineer the UNIRAST raster graphics format used by AirPrint.
21
star
15

DownloadDarwinSource

An Automator workflow to download and extract the complete open source code of any OS X system release.
17
star
16

AQStreamDownloader

A simple class to download a stream to disk or to a memory block
Objective-C
16
star
17

ParserExample

An example project showing how to use the AQXMLParser, HTTPMessage, and AQGzipInputStream classes from AQToolkit.
Objective-C
13
star
18

secret-sauce

Sample code and projects from the Secret Sauce research paper presented at 360|MacDev 2010.
C
11
star
19

iPad-Plist-Viewer

A simple XML property list viewer. Designed to open .plist files from other apps.
Objective-C
11
star
20

NestedPlistEditor

A version of the 'defaults' command-line tool which allows editing of nested properties.
Objective-C
9
star
21

go-trie

A Trie structure implementation for Go, using Unicode runes as keys. Includes a customization for TeX-style hyphenation tries.
Go
9
star
22

cocoa-game-of-life

Simple Game of Life Application written in Objective-C using Cocoa
Objective-C
8
star
23

libdispatch-channels

An implementation of something like Go's channels for Grand Central Dispatch
C
8
star
24

time-machine

An example of in-app TimeMachine support, with a manager class to wrap the C API specifics.
Objective-C
7
star
25

AQWeakRetain

A pure-Foundation version of Omni Group's OFWeakRetain, for weak-retention of objects under manual memory management.
C
7
star
26

go-apns

A Go library for sending push notifications through the Apple Push Notification Service.
Go
7
star
27

AQXML

A complete and holistic XML processing framework in Objective-C. Currently a work in progress.
C++
6
star
28

dynamicpatch

Old code: Patching of PPC, Intel, and Rosetta, similar to Unsanity's APE. Worked on 10.4.2, probably doesn't any more.
C
6
star
29

bdk

The one, the only, the BackRow Development Kit.
Objective-C
6
star
30

atvloader

The original AwkwardTV software installer for the AppleTV.
Objective-C
5
star
31

swift-nio-protobuf

Codecs to aid in handling protocol buffers in your swift-nio pipeline.
Swift
5
star
32

H2Swift

HTTP2 library in pure Swift. Mostly for fun & learning, though I hope to make it close to nghttp2 in performance & capabilities at some point.
Swift
5
star
33

go-hyphenator

A TeX-style hyphenation package for the Go programming language.
Go
4
star
34

SetAppAffinity

A simple command-line app for OS X 10.6 which sets individual files to open using a specific application.
Objective-C
4
star
35

AQURLConnectionInputStream

Provides a means to link a custom NSURLRequest with the stream-based NSXMLParser API in OS X 10.7.
Objective-C
4
star
36

old-go-tmbundle

A TextMate bundle for the Go programming language.
3
star
37

AQOptionParser

A nice idiomatic Objective-C option parser, wrapping getopt_long() and providing localized usage output similar to RubyDoc.
Objective-C
3
star
38

AQInnerClass

Inner classes for Objective-C. Entirely blocks-based, so no ivars on inner classes (just capture from enclosing scope, similar to custom SecTransformRefs).
Objective-C
2
star
39

UntarAction

An automator action for OS X 10.6 which will take a list of tarfile paths/URLs and extract each one to the same directory.
Objective-C
2
star
40

go-gcm

Galois/Counter Mode cryptographic function implementation for Go.
Go
2
star
41

Beginning-ObjC-Project

From chapter 9 of Beginning Objective-C: A simple Core Data-based Contacts application with iCloud support, sandboxing (Address Book access only), and networked sharing of data via an included XPC bundle.
Objective-C
2
star
42

iPhone-Legacy-SDK-Fixer

Fixes the 2.x iPhone SDKs such that they work on 10.6 (i.e. gcc-darwin-10).
Objective-C
2
star
43

filesync-talk

Sample code accompanying my presentation on the File Coordination Cocoa APIs for Toronto CocoaHeads.
Objective-C
1
star
44

swift-zookeeper-support

Provides SwiftPM support for the Zookeeper C libraries.
Swift
1
star