aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-10-21 01:57:13 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-10-21 01:57:13 +0000
commit194304607077742a4fab45e4a3ff2ae80746b990 (patch)
treec611eb52ee24bb0be17b6ee9277f0d012272b7df
parent2c917a92f953a55800f096b4e92b26fc3d35e305 (diff)
parenta1fe889a64469c1cae1d0c81829fc29b5f4f7a5c (diff)
downloadrepohooks-194304607077742a4fab45e4a3ff2ae80746b990.tar.gz
Merge "Add Tool Path for gofmt"
am: a1fe889a64 Change-Id: I27493ebeb64c49390986b1fbb5c305f2e7e6bbe7
-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',
}