aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-10-21 02:11:30 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-10-21 02:11:30 +0000
commit5e73c7cbf89bdd574df763e0d75a58f87f713fcd (patch)
treec611eb52ee24bb0be17b6ee9277f0d012272b7df
parent02e8062136f4e517c62a0c86a97b371f1def3c15 (diff)
parent723744d58c75b4fd60c09bb86e5d1775276a5438 (diff)
downloadrepohooks-5e73c7cbf89bdd574df763e0d75a58f87f713fcd.tar.gz
Merge "Add Tool Path for gofmt" am: a1fe889a64 am: 1943046070
am: 723744d58c Change-Id: I91a624c4dc2f8ff2471beabffeb16e707c596058
-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',
}