dnephin/pre-commit-golang

Can't find `go-mod-tidy` on Windows

echarrod opened this issue · 2 comments

I have the following .pre-commit-config.yaml:

repos:
- repo: git://github.com/dnephin/pre-commit-golang
  rev: master
  hooks:
    - id: go-vet
    - id: go-mod-tidy

When I try to run pre-commit run --all-files I get:

[ERROR] go-mod-tidy is not present in repository git://github.com/dnephin/pre-commit-golang. Typo? Perhaps it is introduced in a newer version? Often pre-commit autoupdate fixes this.

pre-commit autoupdate won't work whilst go-mod-tidy is in the file:

Updating git://github.com/dnephin/pre-commit-golang ... Cannot update because the tip of HEAD is missing these hooks:
go-mod-tidy

So, after removing go-mod-tidy:

Updating git://github.com/dnephin/pre-commit-golang ... updating master -> v0.3.5.

But when I add go-mod-tidy back in again, the same error is present, and it cannot be found.

I am on Windows, I'm not sure whether this affects anything. I've tried uninstalling and reinstalling the hooks too.

Looks like v0.3.5 was released in October, and go-mod-tidy was added last month.
I'm assuming a release with this might fix it, but I'm unsure why having rev: master doesn't seem to be getting the code from master, and it's instead getting the latest released code

Fixed this by updating Git for Windows with:

git update-git-for-windows

and then cleaning pre-commit with:

pre-commit clean

Not sure which one of these it was