I've tried to install these pre-commit hooks in a project of mine, from rev v0.20.0 down to v0.18.0, and it never works. Other hooks (black, pyupgrade...) work fine.
BTW the README gives v0.17.0 as example, but this version lacks a .pre-commit-hooks.yaml file.
[INFO] Installing environment for https://github.com/google/go-jsonnet.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\X\\.cache\\pre-commit\\repop0znd0ul\\golangenv-default\\.go\\bin\\go.EXE', 'install', './...')
return code: 1
stdout: (none)
stderr:
go: downloading github.com/fatih/color v1.10.0
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading sigs.k8s.io/yaml v1.1.0
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading gopkg.in/yaml.v2 v2.2.7
# github.com/google/go-jsonnet/c-bindings
runtime.main_main·f: function main is undeclared in the main package
Check the log at C:\Users\X\.cache\pre-commit\pre-commit.log
Here is the log content.
version information
pre-commit version: 3.7.1
git --version: git version 2.42.0.windows.1
sys.version:
3.10.14 (main, Apr 15 2024, 17:29:58) [MSC v.1929 64 bit (AMD64)]
sys.executable: C:\...\python.exe
os.name: nt
sys.platform: win32
error information
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\X\\.cache\\pre-commit\\repolezwtggi\\golangenv-default\\.go\\bin\\go.EXE', 'install', './...')
return code: 1
stdout: (none)
stderr:
go: downloading github.com/fatih/color v1.12.0
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading sigs.k8s.io/yaml v1.1.0
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading gopkg.in/yaml.v2 v2.2.7
# github.com/google/go-jsonnet/c-bindings
runtime.main_main·f: function main is undeclared in the main package
Traceback (most recent call last):
File "C:\...\site-packages\pre_commit\error_handler.py", line 73, in error_handler
yield
File "C:\...\site-packages\pre_commit\main.py", line 389, in main
return hook_impl(
File "C:\...\site-packages\pre_commit\commands\hook_impl.py", line 271, in hook_impl
return retv | run(config, store, ns)
File "C:\...\site-packages\pre_commit\commands\run.py", line 442, in run
install_hook_envs(to_install, store)
File "C:\...\site-packages\pre_commit\repository.py", line 238, in install_hook_envs
_hook_install(hook)
File "C:\...\site-packages\pre_commit\repository.py", line 94, in _hook_install
lang.install_environment(
File "C:\...\site-packages\pre_commit\languages\golang.py", line 153, in install_environment
lang_base.setup_cmd(prefix, ('go', 'install', './...'), env=env)
File "C:\...\site-packages\pre_commit\lang_base.py", line 86, in setup_cmd
cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
File "C:\...\site-packages\pre_commit\util.py", line 111, in cmd_output_b
raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('C:\\Users\\X\\.cache\\pre-commit\\repolezwtggi\\golangenv-default\\.go\\bin\\go.EXE', 'install', './...')
return code: 1
stdout: (none)
stderr:
go: downloading github.com/fatih/color v1.12.0
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading sigs.k8s.io/yaml v1.1.0
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading gopkg.in/yaml.v2 v2.2.7
# github.com/google/go-jsonnet/c-bindings
runtime.main_main·f: function main is undeclared in the main package
I've tried to install these pre-commit hooks in a project of mine, from rev
v0.20.0
down tov0.18.0
, and it never works. Other hooks (black, pyupgrade...) work fine.BTW the README gives
v0.17.0
as example, but this version lacks a .pre-commit-hooks.yaml file.Here is the log content.
version information
error information