aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-10-20 16:22:14 -0700
committerDan Willemsen <dwillemsen@google.com>2016-10-20 16:35:18 -0700
commit2bd1b8c01518b1d81cf9e9a8720883548b55e10b (patch)
tree50342a40808375825c2314f154fdb91ed19fd54d
parent5c4c293174bb61f0f39035a71acd9084abfa743d (diff)
downloadrepohooks-2bd1b8c01518b1d81cf9e9a8720883548b55e10b.tar.gz
Add Tool Path for gofmt
We shouldn't be using the host install gofmt, but the one in the tree instead. Bug: None Test: repo upload w/Tool Path in GLOBAL-PREUPLOAD.cfg Change-Id: Icfceaeea4b8a77c54b7d90c7d7efa233be4a46ae
-rw-r--r--README.md1
-rw-r--r--rh/hooks.py4
2 files changed, 4 insertions, 1 deletions
diff --git a/README.md b/README.md
index b19a68b..d656ef3 100644
--- a/README.md
+++ b/README.md
@@ -176,6 +176,7 @@ distros/versions. The following tools are recognized:
* `clang-format`: used for the `clang_format` builtin hook.
* `cpplint`: used for the `cpplint` builtin hook.
* `git-clang-format`: used for the `clang_format` builtin hook.
+* `gofmt`: used for the `gofmt` builtin hook.
* `pylint`: used for the `pylint` builtin hook.
Some variables are available to make it easier to handle OS differences. These
diff --git a/rh/hooks.py b/rh/hooks.py
index b77ee42..1f59dd2 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -330,7 +330,8 @@ def check_gofmt(project, commit, _desc, diff, options=None):
if not filtered:
return
- cmd = ['gofmt', '-l'] + options.args((), filtered)
+ gofmt = options.tool_path('gofmt')
+ cmd = [gofmt, '-l'] + options.args((), filtered)
ret = []
for d in filtered:
data = rh.git.get_file_content(commit, d.file)
@@ -442,5 +443,6 @@ TOOL_PATHS = {
'clang-format': 'clang-format',
'cpplint': os.path.join(TOOLS_DIR, 'cpplint.py'),
'git-clang-format': 'git-clang-format',
+ 'gofmt': 'gofmt',
'pylint': 'pylint',
}