We have a beta release of our new Go support packages that is now ready for early testing. Support comes in two packages: ‘golangconfig’ is a developer library used to obtain information about the local Go environment. It will handle configuration ($GOPATH, etc) through a combination of auto-detection and configuration. The end-user ‘Golang Build’ package provides Go toolchain integration with the Sublime build system - go build, go install, go test. It is the first package to utilize the functionality of golangconfig.
We would like our Sublime-using Gophers to test these new codebases by installing Golang Build. Currently the package is only available from a custom Package Control repository. To install it, please:
Open the Sublime Text command palette and type “Add Repository”
Run the “Install Package” command via the command palette
Type “Golang Build” and press enter
Once we have completed a few rounds of testing, the Golang Build package and golangconfig dependency will be added to the default Package Control channel and will be available to all users and package developers.
Documentation for the two packages is available on GitHub.
Please file bugs using the appropriate issue trackers. For problems with Go environment detection and configuration, issues should be filed at:
For bugs related to the build command integration, issues should be filed at:
Our longer term goal is to have other Go-related Sublime packages ported to use golangconfig. This would allow users to set their Go environment configuration in one place and have that used by all of their installed Go/Sublime packages.
Most of the work went into the dependency - ‘golangconfig’. It provides a very nice framework for hierarchical environment configuration that can be used by all Go-related packages you have installed (were they to be ported to use this library):
Sublime global
OS specific
Project specific
Project + OS specific
If/when other packages are ported to use this library, users will also be able to set their Go environment once and have it used everywhere.
Part of the build system is actually a command to open a terminal to the Go environment you are working in. There can always be a reason to drop down to the terminal because of one-off flags, or something similar.
So based on that, you may ask what does this offer beyond just opening the terminal on my OS? Well, for convenience it adds a single keyboard shortcut to run your build or tests. However, it can also be useful due to the Sublime Text settings. Through Sublime Text project files and their settings, it is possible to have different Go workspaces for different projects, and easily run a build, tests, or open a terminal with all of the necessary environment variables set.
I’m not sure this is really a bug in the golang_build package. I assume some other package out there already implements this… I was just hoping someone knew which one.
BTW, I’m trying this right now, and it’s amazing how much time I save by not having to switch windows to the terminal. I didn’t think it would be a big deal, but it really makes a difference, even without the goto line number.
FWIW I had used gosublime in the past, and it was always kind of wonky, so I basically stopped using it except for gofmt on save. This package seems to do exactly what I would want it to do.
Our motivation for developing this is due to the apparent abandonment of the GoSublime project by the original author. The pull requests and issues are accumulating quickly on that codebase.
So we decided we wanted a simpler, composable infrastructure that would improve the experience for all Go-related Sublime packages. That is why the GolangBuild package is fairly simple in terms of features offered.
The GolangConfig package that GolandBuild is based on is designed to serve as a configuration building block for all Go packages. This will allow users to configure their Go environment (PATH, GOPATH, etc.) in one place, and have those settings used by multiple packages.