From 1a2eafb7378cd494b931e8c222b31e296ff6d21a Mon Sep 17 00:00:00 2001 From: syscrusher Date: Tue, 24 Jun 2014 23:23:23 -0500 Subject: [PATCH 01/10] Prep develop branch, git-flow style --- CHANGELOG.md | 5 +++++ README.md | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f9507d..a7bf1c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +###X.X.X / XXXX-XX-XX +Planned: +- Rework some snippets, like a single import without an alias +- Add support for all go tools like fix, vet, lint, oracle + ###2.1.1 / 2014-06-24 - [FIX: gofmt no longer supports -tabwidth or -tabs](https://github.com/syscrusher/golang.tmbundle/commit/122fb557211f3c0db5421cf1288f5b5ebd6bb338) diff --git a/README.md b/README.md index 908e29e..a3ad4ec 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ -## Golang -(a TextMate 2 language bundle) - -Version 2.1.1 +## golang.tmbundle vX.X.X +(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. From cab9712e926e5dd60fd97402f2db45db3c82e49c Mon Sep 17 00:00:00 2001 From: syscrusher Date: Wed, 25 Jun 2014 00:32:35 -0500 Subject: [PATCH 02/10] Add godoc dependency to readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a3ad4ec..1ba4cb6 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,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 From 05553b98afba611f297d4d412d1495e044f0e792 Mon Sep 17 00:00:00 2001 From: syscrusher Date: Fri, 27 Jun 2014 16:24:58 -0500 Subject: [PATCH 03/10] rename compile to build to match go tool language --- Commands/Compile.tmCommand | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Commands/Compile.tmCommand b/Commands/Compile.tmCommand index 1305939..215ff6b 100644 --- a/Commands/Compile.tmCommand +++ b/Commands/Compile.tmCommand @@ -10,8 +10,7 @@ #!/usr/bin/env ruby18 require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" -Go::go "build", :verb => "Compiling" - +Go::go "build", :verb => "Building" input document inputFormat @@ -19,7 +18,7 @@ Go::go "build", :verb => "Compiling" keyEquivalent @b name - Compile + Building outputCaret afterOutput outputFormat From 8fe9e5934daef85493b0a2bc9c1406094735886d Mon Sep 17 00:00:00 2001 From: syscrusher Date: Fri, 27 Jun 2014 16:45:17 -0500 Subject: [PATCH 04/10] rot13 contact email, whoops --- info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.plist b/info.plist index f9f78a7..524fe77 100644 --- a/info.plist +++ b/info.plist @@ -3,7 +3,7 @@ contactEmailRot13 - syscrusher@users.noreply.github.com + flfpehfure@hfref.abercyl.tvguho.pbz contactName syscrusher description From 403d900131e04fcf5403c2643e735ade62816e3c Mon Sep 17 00:00:00 2001 From: syscrusher Date: Fri, 27 Jun 2014 16:55:46 -0500 Subject: [PATCH 05/10] - Rename "Compile" to "Build" to match go tool - Simplify go fmt, make idiomatic - Add go install --- .../{Compile.tmCommand => Build.tmCommand} | 2 +- ...ormat Document.tmCommand => Fmt.tmCommand} | 2 +- Commands/Install.tmCommand | 33 +++++++++++++++++++ info.plist | 1 + 4 files changed, 36 insertions(+), 2 deletions(-) rename Commands/{Compile.tmCommand => Build.tmCommand} (97%) rename Commands/{Reformat Document.tmCommand => Fmt.tmCommand} (97%) create mode 100644 Commands/Install.tmCommand diff --git a/Commands/Compile.tmCommand b/Commands/Build.tmCommand similarity index 97% rename from Commands/Compile.tmCommand rename to Commands/Build.tmCommand index 215ff6b..5616618 100644 --- a/Commands/Compile.tmCommand +++ b/Commands/Build.tmCommand @@ -18,7 +18,7 @@ Go::go "build", :verb => "Building" keyEquivalent @b name - Building + Build outputCaret afterOutput outputFormat diff --git a/Commands/Reformat Document.tmCommand b/Commands/Fmt.tmCommand similarity index 97% rename from Commands/Reformat Document.tmCommand rename to Commands/Fmt.tmCommand index 744ce16..43ee67e 100644 --- a/Commands/Reformat Document.tmCommand +++ b/Commands/Fmt.tmCommand @@ -17,7 +17,7 @@ Go::gofmt keyEquivalent ^H name - Reformat Document + Fmt outputCaret interpolateByLine outputFormat diff --git a/Commands/Install.tmCommand b/Commands/Install.tmCommand new file mode 100644 index 0000000..3ca51c3 --- /dev/null +++ b/Commands/Install.tmCommand @@ -0,0 +1,33 @@ + + + + + autoScrollOutput + + beforeRunningCommand + saveModifiedFiles + command + #!/usr/bin/env ruby18 + +require "#{ENV['TM_BUNDLE_SUPPORT']}/gomate" +Go::go "install", :verb => "Installing" + input + document + inputFormat + text + name + Install + outputCaret + afterOutput + outputFormat + html + outputLocation + newWindow + scope + source.go + uuid + B455A84C-0F20-494A-A3CC-49A89434DAB4 + version + 2 + + diff --git a/info.plist b/info.plist index 524fe77..fe8667c 100644 --- a/info.plist +++ b/info.plist @@ -19,6 +19,7 @@ 0B3C3EB0-9F51-4997-A87D-ECA507D8E31E 0F6A8710-54FC-48F5-9D02-D093DA001D17 73628139-0077-4F09-9B72-77546D7C2D2D + B455A84C-0F20-494A-A3CC-49A89434DAB4 ------------------------------------ D3CD6B51-3A7E-4356-85F4-B76B8336BEF2 7BCFCFC8-9152-4638-8436-E17B0C754C8D From b8afd7b4c6e4cf6ca4cfb401adae851d0046f2db Mon Sep 17 00:00:00 2001 From: syscrusher Date: Fri, 27 Jun 2014 17:25:05 -0500 Subject: [PATCH 06/10] Simplify test, update chnagelog --- CHANGELOG.md | 8 ++++++-- Commands/Test.tmCommand | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7bf1c5..39714da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ -###X.X.X / XXXX-XX-XX -Planned: +Planned: - Rework some snippets, like a single import without an alias - Add support for all go tools like fix, vet, lint, oracle +###X.X.X / XXXX-XX-XX +- Rename "Compile" to "Build" to match go tool +- Simplify go fmt, make idiomatic +- Add go install + ###2.1.1 / 2014-06-24 - [FIX: gofmt no longer supports -tabwidth or -tabs](https://github.com/syscrusher/golang.tmbundle/commit/122fb557211f3c0db5421cf1288f5b5ebd6bb338) diff --git a/Commands/Test.tmCommand b/Commands/Test.tmCommand index a990ec5..ba2c9f8 100644 --- a/Commands/Test.tmCommand +++ b/Commands/Test.tmCommand @@ -19,7 +19,7 @@ Go::go "test", :verb => "Testing" keyEquivalent @R name - Run Tests + Test outputCaret afterOutput outputFormat From be18b3daa5335e095943e3f155930b80c0bfcf82 Mon Sep 17 00:00:00 2001 From: syscrusher Date: Fri, 27 Jun 2014 20:28:11 -0500 Subject: [PATCH 07/10] Install/build/test/run all now operate on the package the current file resides in, instead of on the specific file --- Commands/Install.tmCommand | 17 +++++++++++++++++ Support/gomate.rb | 12 ++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Commands/Install.tmCommand b/Commands/Install.tmCommand index 3ca51c3..a89b4ee 100644 --- a/Commands/Install.tmCommand +++ b/Commands/Install.tmCommand @@ -15,6 +15,8 @@ Go::go "install", :verb => "Installing" document inputFormat text + keyEquivalent + @I name Install outputCaret @@ -23,6 +25,21 @@ Go::go "install", :verb => "Installing" html outputLocation newWindow + requiredCommands + + + command + go + locations + + /opt/local/bin/go + /usr/local/bin/go + /usr/local/go/bin/go + + variable + TM_GO + + scope source.go uuid diff --git a/Support/gomate.rb b/Support/gomate.rb index 14da282..2feccc2 100755 --- a/Support/gomate.rb +++ b/Support/gomate.rb @@ -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 @@ -29,9 +29,13 @@ def Go::go(command, options={}) args.push("#{basename}_test.go") 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(go_pkg) end args.push(opts) From 789d97d374d803853e9a7c331eeecf4108992c7d Mon Sep 17 00:00:00 2001 From: syscrusher Date: Fri, 27 Jun 2014 20:42:18 -0500 Subject: [PATCH 08/10] Test now runs all package tests. Fixed run command, submits current file and should run main package --- Support/gomate.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Support/gomate.rb b/Support/gomate.rb index 2feccc2..f7592db 100755 --- a/Support/gomate.rb +++ b/Support/gomate.rb @@ -22,11 +22,10 @@ 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 # Default to running against directory, which in go should be the package @@ -35,6 +34,7 @@ def Go::go(command, options={}) 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) From 8e666c63135bd9bb32840211dd2db8f64534c81f Mon Sep 17 00:00:00 2001 From: syscrusher Date: Sat, 28 Jun 2014 20:30:38 -0500 Subject: [PATCH 09/10] Update readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 1ba4cb6..44a9da3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ ### 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: From a32a0e4e98216d5aab42aea8cb0d3773169312ed Mon Sep 17 00:00:00 2001 From: syscrusher Date: Sat, 28 Jun 2014 20:36:48 -0500 Subject: [PATCH 10/10] Release v2.2.0 --- CHANGELOG.md | 12 ++++++++---- README.md | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39714da..82f0f10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,14 @@ Planned: - Rework some snippets, like a single import without an alias - Add support for all go tools like fix, vet, lint, oracle -###X.X.X / XXXX-XX-XX -- Rename "Compile" to "Build" to match go tool -- Simplify go fmt, make idiomatic -- Add go install +###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) diff --git a/README.md b/README.md index 44a9da3..2e54643 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## golang.tmbundle vX.X.X +## golang.tmbundle v3.0.0 (a TextMate 2 bundle for the go programming language) ### Installation