Merge "hooks: gofmt: fix argument handling" am: e2a519ed6f

Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/2621058

Change-Id: I31c85fa5481a304bd4554405e934ddaaba0692b8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/rh/hooks.py b/rh/hooks.py
index e5ca8eb..457a440 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -858,13 +858,14 @@
         return None
 
     gofmt = options.tool_path('gofmt')
-    cmd = [gofmt, '-l'] + options.args((), filtered)
+    cmd = [gofmt, '-l'] + options.args()
+    fixup_cmd = [gofmt, '-w'] + options.args()
+
     ret = []
     for d in filtered:
         data = rh.git.get_file_content(commit, d.file)
         result = _run(cmd, input=data)
         if result.stdout:
-            fixup_cmd = [gofmt, '-w']
             ret.append(rh.results.HookResult(
                 'gofmt', project, commit, error=result.stdout,
                 files=(d.file,), fixup_cmd=fixup_cmd))