Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/AlanQuatermain/go-tmbundle
Browse files Browse the repository at this point in the history
* 'master' of git://github.com/AlanQuatermain/go-tmbundle:
  Added 'error' type from Go version 1.0
  I hate tabs. And I hate RDoc being sensitive to different amounts of whitespace via tabs/spaces. Sigh.
  Tweaks to RDoc formatting in README/History.
  Added 'deferred function call' snippet and updated readme/history for release 1.3.
  Use GOBIN shell variable instead of PATH if present
  Fix for source filenames with spaces bug.
  revert goroot
  fixed issue AlanQuatermain#6
  Removed some very annoying extra newlines in snippets.
  added x86_64 as a valid architecture string
  Size modifiers are not optional for float or complex.
  • Loading branch information
puchupala committed Nov 29, 2011
2 parents 7e21717 + 79a6a6d commit 89b6121
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 67 deletions.
28 changes: 27 additions & 1 deletion History.rdoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
=== 1.3 / 2011-11-22
* Includes a wrapper for +gotest+ on Cmd-Opt-T.
* Imported some community additions and bugfixes to bring compatibility with OS X 10.7 and TextMate 1.5.1:
[https://github.com/AlanQuatermain/go-tmbundle/commit/97f8c44552b0347c9d89f948a5fb92172f32daca]
*mkhl* <em>Use default values for GOOS and GOARCH only when necessary.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/c85768b573f47d7274066b1260df6627ce35b82f]
*rsesek* <em>Include the receiver in entity.name.function scope so that it shows up in the symbol list.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/2eeb1c60f975af7cc3250964c9da58fca37d57f8]
*guncha* <em>Add gocode completion support.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/b730967fbd14e58bcc32d7f5157234cfa48f4043]
*guncha* <em>Add proper argument handling for functions.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/837e04fba7e6e4a3127006be5fa3f1d04e357cba]
*guncha* <em>Fix links not working properly when html output is produced while compiling a project with errors.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/69797af68e37e171fa12e3aa3f0ce9340369a453]
*chriseaton* <em>Size modifiers are not optional for float or complex.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/05ba567d62018b87619d77653b728fcd25c270fb]
*schmurfy* <em>added x86_64 as a valid architecture string.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/2912e001142b2e0921f4f5f5c568734ccc6bf701]
*TassoLee* <em>Fix for issue #6.</em>
[https://github.com/AlanQuatermain/go-tmbundle/commit/67e6118d245ba4d9901b2fe869ca2c3a3bea4672]
*TassoLee* <em>Revert goroot.</em>
[https://github.com/guncha/go-tmbundle/commit/27142544725331d465aed364eacb67d2c4b1eeb7]
*guncha* <em>Fix for source filenames with spaces bug.</em>
[https://github.com/KnightBaron/go-tmbundle/commit/eb925bb53f71ab472d67c5ac9cfd78d7cc02be85]
*KnightBaron* <em>Use GOBIN shell variable instead of PATH if present.</em>

=== 1.2 / 2010-06-13
* Many new snippets and updates to the command-runner implementation, courtesy of Martin Kühl (http://github.com/mkuhl).
* Many new snippets and updates to the command-runner implementation, courtesy of Martin Kühl (http://github.com/mkhl).

=== 1.0.3 / 2010-03-28
* Removed the no-longer-supported -oldparser flags from the invocation of the gofmt command
Expand Down
91 changes: 47 additions & 44 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
== Go
(a TextMate language bundle)
Version 1.2
Version 1.3

=== Installation

Expand All @@ -16,51 +16,54 @@ Ensure you've got a recent copy of git installed, then copy this line to your Te
The bundle here implements a language syntax, some snippets, and some compile/format/documentation commands for the Go language (http://golang.org/). Much of the current infrastructure was created by Martin Kühl (http://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 return types.
+meth+:: declares a function on a particular type, with additional tab stops for receiver name and type.
+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.
+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 range.
+go+:: an immediate goroutine call (defines the function inline).
+de+:: a deferred call (defines the function inline).
+main+:: skeleton main() function.
+init+:: skeleton init() function.
+,+:: a pair ('first, second').
+<+:: send/receive through a channel.
+ret+:: a return statement with optional return value.
[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.
[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.
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Constants.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>const (
${1:name}${2/(.+)/ /}${2:type} = ${0:value}
)
</string>
)</string>
<key>name</key>
<string>Constants</string>
<key>scope</key>
Expand Down
2 changes: 1 addition & 1 deletion Snippets/Deferred Call.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
${0:// body}
}(${2:${1/(.+)?/(?1:values)/}})</string>
<key>name</key>
<string>Deferred Call</string>
<string>Deferred Goroutine Call</string>
<key>scope</key>
<string>source.go</string>
<key>tabTrigger</key>
Expand Down
16 changes: 16 additions & 0 deletions Snippets/Deferred Function Call.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>defer ${0:file.Close()}</string>
<key>name</key>
<string>Deferred Function Call</string>
<key>scope</key>
<string>source.go</string>
<key>tabTrigger</key>
<string>def</string>
<key>uuid</key>
<string>AA2A0BCD-98B2-4B31-9F54-4207073E201C</string>
</dict>
</plist>
3 changes: 1 addition & 2 deletions Snippets/Function w: result vars.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>func${3/(.+)/ /}${3:name}(${4:params}) (${5:type}) {
${0:// body}
}
</string>
}</string>
<key>name</key>
<string>Function w/ result vars</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Function.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>func${3/(.+)/ /}${3:name}(${4:params})${5/(.+)/ /}${5:type} {
${0:// body}
}
</string>
}</string>
<key>name</key>
<string>Function</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Import.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<plist version="1.0">
<dict>
<key>content</key>
<string>import${2/(.+)/ /}${2:$1} "${1:package}"
</string>
<string>import${2/(.+)/ /}${2:$1} "${1:package}"</string>
<key>name</key>
<string>Import</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Imports.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>import (
"${0:package}"
)
</string>
)</string>
<key>name</key>
<string>Imports</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Init Function.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>func init() {
${0:// body}
}
</string>
}</string>
<key>name</key>
<string>Init Function</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Main Function.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>func main() {
${0:// body}
}
</string>
}</string>
<key>name</key>
<string>Main Function</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Method w: result vars.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>func (${1:receiver} ${2:type}) ${3:name}(${4:params}) (${5:type}) {
${0:// body}
}
</string>
}</string>
<key>name</key>
<string>Method w/ result vars</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Method.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
<key>content</key>
<string>func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} {
${0:// body}
}
</string>
}</string>
<key>name</key>
<string>Method</string>
<key>scope</key>
Expand Down
3 changes: 1 addition & 2 deletions Snippets/Package.tmSnippet
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<string>${1/^main$|(.+)/(?1:\/*
The $1 package implements ... bananas?
*\/
)/}package ${1:main}
</string>
)/}package ${1:main}</string>
<key>name</key>
<string>Package</string>
<key>scope</key>
Expand Down
4 changes: 4 additions & 0 deletions Support/bin/goarch
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ go_arch () {
arm)
echo "arm"
;;
x86_64)
echo "amd64"
;;

i386)
case "`sysctl -n hw.optional.x86_64 2>/dev/null`" in
1)
Expand Down
2 changes: 1 addition & 1 deletion Syntaxes/Go.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
</dict>
<dict>
<key>match</key>
<string>(\b|(?&lt;=\]))(int(16|8|32|64)?|uint(16|8|32|64|ptr)?|float(32|64)?|complex(64|128)?|b(yte|ool)|string)\b</string>
<string>(\b|(?&lt;=\]))(int(16|8|32|64)?|uint(16|8|32|64|ptr)?|float(32|64)|complex(64|128)|b(yte|ool)|string|error)\b</string>
<key>name</key>
<string>storage.type.go</string>
</dict>
Expand Down
2 changes: 2 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@
<string>8C557B1F-C1C5-4FC3-830E-9D51DE6CFA5A</string>
<string>6B01E886-4CFA-476E-AE01-EFF406116978</string>
<string>92CF0E27-7ED9-4F9B-8061-DD2B38D22893</string>
<string>AA2A0BCD-98B2-4B31-9F54-4207073E201C</string>
<string>18A04BC9-D37A-46B9-8C92-4E8D287A46E4</string>
<string>54394BD4-1FFE-440F-9D3D-2D44F3B1BCC6</string>
<string>0FC09B94-D4C1-4C21-8076-EE7075174926</string>
<string>0E515A1F-B6F7-4473-B4C6-D6485E7CD133</string>
<string>4B3F378E-D9E8-4CCB-B537-96099B406511</string>
<string>214A69FB-0168-465E-AB51-D8C6C46BCF61</string>
<string>FE908865-7729-4926-9FAC-2D54895BEA48</string>
</array>
<key>uuid</key>
<string>9A94FED7-9430-410F-9C6A-5B9D48A89180</string>
Expand Down

0 comments on commit 89b6121

Please sign in to comment.