Skip to content

Commit

Permalink
Merge branch 'release/v2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
syscrusher committed Jun 29, 2014
2 parents 710fe0b + a32a0e4 commit 02bba96
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 20 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Planned:
- Rework some snippets, like a single import without an alias
- Add support for all go tools like fix, vet, lint, oracle

###3.0.0 / 2014-06-28
Default behavior of some commands has changed, so the version was incremented a major number to indicate backwards-incompatible behavior

- [Install, Build, Test, and Run commands all operate on current package instead of current file](https://github.com/syscrusher/golang.tmbundle/commit/be18b3daa5335e095943e3f155930b80c0bfcf82)
- [Rename "Compile" to "Build" to match go tool](https://github.com/syscrusher/golang.tmbundle/commit/403d900131e04fcf5403c2643e735ade62816e3c)
- [Simplify go fmt, make idiomatic](https://github.com/syscrusher/golang.tmbundle/commit/403d900131e04fcf5403c2643e735ade62816e3c)
- [Add go install command](https://github.com/syscrusher/golang.tmbundle/commit/403d900131e04fcf5403c2643e735ade62816e3c)
- [Add godoc dependency](https://github.com/syscrusher/golang.tmbundle/commit/cab9712e926e5dd60fd97402f2db45db3c82e49c)

###2.1.1 / 2014-06-24
- [FIX: gofmt no longer supports -tabwidth or -tabs](https://github.com/syscrusher/golang.tmbundle/commit/122fb557211f3c0db5421cf1288f5b5ebd6bb338)

Expand Down
5 changes: 2 additions & 3 deletions Commands/Compile.tmCommand → Commands/Build.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
<string>#!/usr/bin/env ruby18
require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate"
Go::go "build", :verb =&gt; "Compiling"
</string>
Go::go "build", :verb =&gt; "Building"</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@b</string>
<key>name</key>
<string>Compile</string>
<string>Build</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Go::gofmt
<key>keyEquivalent</key>
<string>^H</string>
<key>name</key>
<string>Reformat Document</string>
<string>Fmt</string>
<key>outputCaret</key>
<string>interpolateByLine</string>
<key>outputFormat</key>
Expand Down
50 changes: 50 additions & 0 deletions Commands/Install.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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>autoScrollOutput</key>
<true/>
<key>beforeRunningCommand</key>
<string>saveModifiedFiles</string>
<key>command</key>
<string>#!/usr/bin/env ruby18
require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate"
Go::go "install", :verb =&gt; "Installing"</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@I</string>
<key>name</key>
<string>Install</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>html</string>
<key>outputLocation</key>
<string>newWindow</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>go</string>
<key>locations</key>
<array>
<string>/opt/local/bin/go</string>
<string>/usr/local/bin/go</string>
<string>/usr/local/go/bin/go</string>
</array>
<key>variable</key>
<string>TM_GO</string>
</dict>
</array>
<key>scope</key>
<string>source.go</string>
<key>uuid</key>
<string>B455A84C-0F20-494A-A3CC-49A89434DAB4</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Commands/Test.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Go::go "test", :verb =&gt; "Testing"
<key>keyEquivalent</key>
<string>@R</string>
<key>name</key>
<string>Run Tests</string>
<string>Test</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## Golang
(a TextMate 2 language bundle)

Version 2.1.1
## golang.tmbundle v3.0.0
(a TextMate 2 bundle for the go programming language)

### Installation
TextMate by default will detect .go files and load [Jim Dovey's bundle](https://github.com/AlanQuatermain/go-tmbundle). This is a fork with additional improvements merged from around the community.

Big changes from the default version:
- go test, build, run, and install all operate on the package level instead of per file
- added println and and printf snippets
- bugfixes

To install this bundle manually, open a Terminal window and do:

Expand All @@ -16,10 +18,11 @@ git clone git://github.com/syscrusher/golang.tmbundle.git
```


This bundle uses gocode for completion, which can be installed via:
This bundle uses gocode for completion and godoc for documentation, which can be installed with:

```Shell
go get -u github.com/nsf/gocode
go get -u code.google.com/p/go.tools/cmd/godoc
```

### Features
Expand Down
22 changes: 13 additions & 9 deletions Support/gomate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# TextMate's special GOPATH used in .tm_properties files prepended to the environment's GOPATH
ENV['GOPATH'] = (ENV.has_key?('TM_GOPATH') ? ENV['TM_GOPATH'] : '') +
(ENV.has_key?('GOPATH') ? ':' + ENV['GOPATH'] : '')

module Go
def Go::go(command, options={})
# TextMate's special TM_GO or expect 'go' on PATH
Expand All @@ -22,16 +22,20 @@ def Go::go(command, options={})
opts = {:use_hashbang => false, :version_args => ['version'], :version_regex => /\Ago version (.*)/}
opts[:verb] = options[:verb] if options[:verb]

if command == 'test' && ENV['TM_FILENAME'] =~ /(_test)?(\.go)$/
basename = $`
args.push("-v")
args.push("#{basename}.go")
args.push("#{basename}_test.go")
if command == 'run'
file_length = ENV['TM_DIRECTORY'].length + 1
go_file = ENV['TM_FILEPATH'][file_length..-1]
args.push(go_file)
opts[:chdir] = ENV['TM_DIRECTORY']
else
# At this time, we will always run 'go' against a single file. In the future there may be new
# commands that will invalidate this but until then, might as well start simple.
args.push(ENV['TM_FILEPATH'])
# Default to running against directory, which in go should be the package
# Useful for more cases, like install and build
# Assumes a standard setup and may not function with all pkg managers
opts[:chdir] = ENV['TM_DIRECTORY']
pkg_length = ENV['GOPATH'].length + 4 # GOPATH + /src/
go_pkg = ENV['TM_DIRECTORY'][pkg_length..-1] # subtract above, is pkg name
args.push("-v") # list packages being operated on
args.push(go_pkg)
end
args.push(opts)

Expand Down
3 changes: 2 additions & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>contactEmailRot13</key>
<string>[email protected]</string>
<string>[email protected]</string>
<key>contactName</key>
<string>syscrusher</string>
<key>description</key>
Expand All @@ -19,6 +19,7 @@
<string>0B3C3EB0-9F51-4997-A87D-ECA507D8E31E</string>
<string>0F6A8710-54FC-48F5-9D02-D093DA001D17</string>
<string>73628139-0077-4F09-9B72-77546D7C2D2D</string>
<string>B455A84C-0F20-494A-A3CC-49A89434DAB4</string>
<string>------------------------------------</string>
<string>D3CD6B51-3A7E-4356-85F4-B76B8336BEF2</string>
<string>7BCFCFC8-9152-4638-8436-E17B0C754C8D</string>
Expand Down

0 comments on commit 02bba96

Please sign in to comment.