New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command: go install
fails with: error obtaining VCS status: exit status 128 while installing check
#2722
Comments
it works fine for me in both 2.21 and 3.0 -- do you have any other |
I am not sure what the cause might be. One thing I have noticed is when I was doing interactive rebase with renaming commit, the pre-commit check installation/initialization succeeded - what comes to my mind - maybe some timeouts?
Additional information:Git version: This is my $ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/.../Library/Caches/go-build"
GOENV="/Users/.../Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/.../go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/.../go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.5/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jh/6dnhwcxn5m592yf4_l1nkr_r0000gn/T/go-build2822682343=/tmp/go-build -gno-record-gcc-switches -fno-common" |
my guess is the error was needing to upgrade macos CLT or whatever. either way it's working now |
I'm facing this error right now on my Linux box while it works perfectly on my macOS box.
I'm running Elementary OS 6 (Ubuntu Focal like) and I did install it using |
can you share the same information as above? -- generally this failure isn't a pre-commit problem and is instead a misconfiguration of |
Sure, here it is : Additional information:Git version:
|
yeah I need your config and everything else too |
Oops, sorry : pre-commit --version
.pre-commit-config.yamlrepos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
hooks:
- id: terraform_fmt
- id: terraform_docs
- id: terraform_tfsec
- id: terraform_validate
- repo: https://github.com/zricethezav/gitleaks
rev: v8.15.3
hooks:
- id: gitleaks ~/.cache/pre-commit/pre-commit.log if presentversion information
error information
|
can you share |
env | grep -Ei '(GIT|PRE_COMMIT|GO)' | sort
~/.gitconfig
ls -al ~/.cache/pre-commit
|
tried reproducing in docker and didn't really get anywhere -- any chance you could strace and see what |
I'm getting this on MacOS so I can't use strace for me is failing on the same package just a slightly different version.
|
I'm encountering this now. WorkaroundI'm able to circumvent this problem by committing once like so:
After this succeeded, if I run
after Research and observationsSome research indicates that it's related to one or more of the following:
Possible remedies
See also:
Requested troubleshooting informationversion information
error information
|
[Problems with pre-commit's invocation of `go install`][pc-gh2722] had me wanting more options for how to run hooks in case the automated installation fails. Since checkmake is available in at least Homebrew, it'd be nice to have a hook that can use a checkmake executable already installed in the system PATH. [pc-gh2722]: pre-commit/pre-commit#2722
Although checkmake is currently broken because of pre-commit/pre-commit#2722
I'm encountering this on Linux, too.
|
can you strace and figure out why git is mad? |
I can try. I've not used strace before, though. One thing I've noticed on this Linux system is that if I run If I run What's the difference in environment between when pre-commit needs to install hooks at commit time versus what happens when |
there shouldn't be a difference -- I haven't been able to reproduce the findings either way |
but I think strace isn't attaching to the process(es) launched from
The output log is 22 MB. I'm pretty lost in it with the time I have available right now. I've attached it as a ~2.9 MB gzip. Hopefully I'm not leaking anything in this; this Linux system is actually WSL and there's virtually nothing on it. |
I think with |
I've run into the same problem, this post actually fixed the issue for me too. Running |
I'm running into the same issue while running
This workaround worked for me: prefix the |
I just ran into this. I believe the cause is the fact pre-commit/pre_commit/languages/golang.py Line 144 in 15bd0c7
GIT_INDEX_FILE when git commit is being run. Here's a reproduction using pre-commit (tested on pre-commit 3.3.3 , go version go1.21.6 linux/amd64 , though I expect the same behaviour for any Go version >= 1.18 when Go started including VCS info in builds):
repo="$(mktemp --directory)"
git init "$repo"
cd "$repo"
cat <<EOF >.pre-commit-config.yaml
repos:
# repo doesn't matter, anything using Go
- repo: https://github.com/segmentio/golines
rev: v0.10.0
hooks:
- id: golines
EOF
git add .pre-commit-config.yaml
pre-commit install
# setup some fresh caches to ensure we do a full download+build
mkdir gocache gomodcache pre-commit-cache
GOFLAGS='-x' GOCACHE="$PWD/gocache" GOMODCACHE="$PWD/gomodcache" PRE_COMMIT_HOME="$PWD/pre-commit-cache" git commit --all --message 'Install pre-commit'
Note the line Maybe the env needs to be cleaned with something like Line 27 in 15bd0c7
go install ? Or, as others have noted setting the buildvcs build flag: go install -buildvcs=false ./...
Here's a standalone reproduction, install this under #!/usr/bin/env bash
set -o errexit -o pipefail -o nounset
dest="$(mktemp --directory)"
trap 'rm -rf -- "$dest"' EXIT
# ensure GIT_INDEX_FILE is unset during clone, I believe `pre-commit` does this
# otherwise things can fail earlier on, or (confusingly) work fine
env --unset GIT_INDEX_FILE git clone --depth 1 https://github.com/segmentio/golines "$dest"
cd "$dest"
GOFLAGS='-x -v' go install ./... NOTE: I found this didn't reproduce unless the |
finally a reproduction! thank you this should be easy enough to fix with the git helper |
search you tried in the issue tracker
error obtaining VCS status: exit status
describe your issue
I was just running the pre-commit checks. It looks like the failures started after the update.
git commit -am "My ultimate commit"
Output:
I have also tried to run:
pre-commit clean
but it did not help.pre-commit --version
pre-commit 3.0.0
.pre-commit-config.yaml
~/.cache/pre-commit/pre-commit.log (if present)
version information
error information
The text was updated successfully, but these errors were encountered: