[go] Favor go1.17 in "go mod tidy".

It sometimes encounters conflicts that need a decision like:

.../kms imports
  cloud.google.com/go/kms/apiv1 loaded from
  cloud.google.com/go/kms@v0.2.0,
  but go 1.16 would select v1.4.0

To upgrade to the versions selected by go 1.16:
  go mod tidy -go=1.16 && go mod tidy -go=1.17
If reproducibility with go 1.16 is not needed:
  go mod tidy -compat=1.17

Also fix stderr reference in CalledProcessError. It appears this
script is executed by Python2 despite starting with
"#!/usr/bin/env python3".

R=ddoman@chromium.org, iannucci@chromium.org

Change-Id: I07e083f585e86ae08b58c45da58718bd4bda325b
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/3655015
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
diff --git a/go.sum b/go.sum
index f1cf29d..11b54f6 100644
--- a/go.sum
+++ b/go.sum
@@ -113,7 +113,6 @@
 github.com/aws/aws-sdk-go v1.40.42/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=
 github.com/bazelbuild/buildtools v0.0.0-20210911013817-37179d5767a1 h1:Qx2kGjXQwHHfkIi1nboFTPD6tbky29E80Q1xFcDmC6o=
 github.com/bazelbuild/buildtools v0.0.0-20210911013817-37179d5767a1/go.mod h1:689QdV3hBP7Vo9dJMmzhoYIyo/9iMhEmHkJcnaPRCbo=
-github.com/bazelbuild/remote-apis v0.0.0-20210718193713-0ecef08215cf/go.mod h1:ry8Y6CkQqCVcYsjPOlLXDX2iRVjOnjogdNwhvHmRcz8=
 github.com/bazelbuild/remote-apis v0.0.0-20210812183132-3e816456ee28 h1:lxnT86MpnwOnQoYVc/SaFwl8hZwVBEcznJWt9kYLwvs=
 github.com/bazelbuild/remote-apis v0.0.0-20210812183132-3e816456ee28/go.mod h1:ry8Y6CkQqCVcYsjPOlLXDX2iRVjOnjogdNwhvHmRcz8=
 github.com/bazelbuild/remote-apis-sdks v0.0.0-20220422144733-8780f11b1bb2 h1:P/AG2n11jVtXVWH9Zk9LPaopLD8pr2x5xROxpw5Qlk0=
@@ -427,7 +426,6 @@
 github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/mostynb/zstdpool-syncpool v0.0.7/go.mod h1:YpzqIpN8xvRZZvemem7CMLPWkjuaKR37MnkQruSj6aw=
 github.com/mostynb/zstdpool-syncpool v0.0.10 h1:7FmyEULkmB+q8PvL6Yz8HoGxT2ZZ4O+/w/j1Ut6/31A=
 github.com/mostynb/zstdpool-syncpool v0.0.10/go.mod h1:BmhpjzZxG8KCduFi0N/Do6j9w+JYt6vR2cM8J9AwujI=
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
@@ -439,7 +437,6 @@
 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
 github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
 github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
-github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
 github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw=
 github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
@@ -473,7 +470,6 @@
 github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
 github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
 github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
-github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
 github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
@@ -700,7 +696,6 @@
 golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
diff --git a/scripts/check_go_mod_tidy.py b/scripts/check_go_mod_tidy.py
index e68413f..be91c1e 100755
--- a/scripts/check_go_mod_tidy.py
+++ b/scripts/check_go_mod_tidy.py
@@ -43,7 +43,7 @@
     # This command modifies go.mod and/or go.sum if they are untidy. There's
     # currently no way to ask it to check their tidiness without overriding
     # them. See https://github.com/golang/go/issues/27005.
-    subprocess.check_call(['go', 'mod', 'tidy'])
+    subprocess.check_call(['go', 'mod', 'tidy', '-compat=1.17'])
 
     # Check the diff, it should be empty.
     for old, new in MOD_FILES:
@@ -52,13 +52,13 @@
         print('%s file is stale:' % old)
         print(mod_diff)
         print()
-        print('Run "go mod tidy" to update it.')
+        print('Run "go mod tidy -compat=1.17" to update it.')
         return 1
 
   except subprocess.CalledProcessError as exc:
     print(
         'Failed to call %s, return code %d:\n%s' %
-        (exc.cmd, exc.returncode, exc.stderr))
+        (exc.cmd, exc.returncode, exc.output))
     return 2
 
   finally:
@@ -76,7 +76,7 @@
   out, err = proc.communicate()
   if proc.returncode and err:
     raise subprocess.CalledProcessError(
-        returncode=proc.returncode, cmd=cmd, output=out, stderr=err)
+        returncode=proc.returncode, cmd=cmd, output=err)
   return out.strip()