Golang Build: Missed patch set from initial implementation
These changes were identified during initial code review and were
supposed to be part of the initial implementation but were somehow
missed.
Change-Id: Ie3e59409d5ca820fc28c90ff506295dcda5d6c8c
diff --git a/docs/configuration.md b/docs/configuration.md
index 20ed406..ea2968c 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -13,6 +13,8 @@
- [OS-Specific Settings](#os-specific-settings)
- [Project-Specific Settings](#project-specific-settings)
- [Command Flags](#command-flags)
+ - [Formatting Command Flag Settings](#formatting-command-flag-settings)
+ - [Command Flag Setting Locations](#command-flag-setting-locations)
## Environment Autodetection
@@ -156,9 +158,52 @@
- `cross_compile:flags` for "go build" with GOOS and GOARCH
- `get:flags` for "go get"
-Each setting must have a value that is a list of strings.
+Any valid flag may be passed to the `go` executable via these settings.
-The most common location to set these settings will be in a project file:
+### Formatting Command Flag Settings
+
+Each setting must have a value that is a list of strings. Each list element
+contains a single command line argument.
+
+A flag without a value would be formatted as:
+
+```json
+{
+ "build:flags": ["-x"]
+}
+```
+
+Multiple flags are formatted as separate strings:
+
+```json
+{
+ "build:flags": ["-x", "-a"]
+}
+```
+
+If a flag accepts a value, the value should be added as a second string:
+
+```json
+{
+ "build:flags": ["-p", "4"]
+}
+```
+
+Strings arguments may contain spaces. The Golang Build package will ensure
+they are properly quoted when invoking the `go ` executable.
+
+```json
+{
+ "build:flags": ["-ldflags", "-L/usr/local/lib -L/opt/lib"]
+}
+```
+
+All flags are inserted at the end of the command line arguments, except in the
+case of `go get`, where they are placed before the URL to get.
+
+### Command Flag Setting Locations
+
+The most common location to set flag settings will be in a project file:
```json
{
@@ -196,3 +241,17 @@
}
}
```
+
+If flags should be applied to all Go builds, irrespective of project, the
+settings may be added to the
+[global Sublime Text settings](#global-sublime-text-settings):
+
+```json
+{
+ "build:flags": ["-a", "-race"]
+}
+```
+
+Do note that settings do not combine from the global Sublime Text settings and
+project settings. Instead, any settings in a more specific location will
+override those in a less specific location.
diff --git a/docs/design.md b/docs/design.md
index c20f484..793b3a9 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -20,7 +20,7 @@
- Configuration uses the Package Control dependency golangconfig, which allows
users to set settings globally in Sublime Text, for each OS globally,
per-project, or for each OS in a project
- - Settings exists that allow users to customize command line flags on a
+ - Settings exist that allow users to customize command line flags on a
per-task-basis
As is dictated by the Sublime Text API, the following list shows a mapping of
diff --git a/golang_build.py b/golang_build.py
index 7062af9..b44c428 100644
--- a/golang_build.py
+++ b/golang_build.py
@@ -73,7 +73,7 @@
command line to learn about available flags.
"""
- if _yeild_to_running_build(self.window):
+ if _yield_to_running_build(self.window):
return
working_dir = _determine_working_dir(self.window)
@@ -254,7 +254,7 @@
flags.
"""
- if _yeild_to_running_build(self.window):
+ if _yield_to_running_build(self.window):
return
working_dir = _determine_working_dir(self.window)
@@ -353,7 +353,7 @@
newterm.launch_terminal(working_dir, env=env_overrides)
-def _yeild_to_running_build(window):
+def _yield_to_running_build(window):
"""
Check if a build is already running, and if so, allow the user to stop it,
or cancel the new build