bazel-contrib / rules_go

Go rules for Bazel
Apache License 2.0
1.39k stars 662 forks source link

Bad git clone command when importing rules_go 0.18.0 #1983

Closed smukherj1 closed 5 years ago

smukherj1 commented 5 years ago

I was trying to upgrade the rules_go version in bazelbuild/rules_k8s and when I tried 0.18.0 I get

git clone --shallow-since=1513256923 +0000 https://go.googlesource.com/text /usr/local/google/home/<uname>/.cache/bazel/_bazel_<uname>/a1bcb3b63a242c66f0c6010821551247/external/org_golang_x_text                                 
fatal: Too many arguments.  

It works fine with 0.17.1. To reproduce, download bazelbuild/rules_k8s, update the rules_go version in the WORKSPACE file to 0.18.0 and run

bazel build -- //... -//images/gcloud-bazel:gcloud_install -//images/gcloud-bazel:gcloud_push
jayconrod commented 5 years ago

What version of git do you have installed? Support for --shallow-since is required, and it looks like that was added in 2.11.

(The Bazel git_repository rule uses --shallow-since. In rules_go 0.18.0, more repositories were converted to git_repository. That's probably why you're seeing this now.)

smukherj1 commented 5 years ago

I'm using git version 2.21.0.360.g471c308f928-goog

jayconrod commented 5 years ago

I wasn't able to reproduce this in rules_k8s with the same build command. That version of git should work. I have a slightly older version, 2.21.0.352.gf09ad66450-goog.

I've seen this error come up once in Travis CI. I believed they had an older version of git install on some of their macs, but I wasn't able to confirm that.

In any case, I'm 95% sure this is a git or Bazel git_repository issue, so I'm going to close this.

avagin commented 5 years ago
$ git clone --shallow-since=1513256923 +0000 https://go.googlesource.com/text /tmp/text
fatal: Too many arguments.
$ git --version
git version 2.21.0

This error is reported due to incorrect format of date. +00000 isn't expected here.

avagin commented 5 years ago

https://github.com/bazelbuild/bazel/commit/d79786d45be22b27f9dce9a03a5b0cb97daed414