Search code examples
pre-commitpre-commit.comtalisman

Unexpected Error on committing changes when Talisman is setup for my repository


I did a Talisman setup for my project repository and now I am unable to commit changes to a branch. It aborts with the following error. Please help!

[INFO] Installing environment for https://github.com/thoughtworks/talisman.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('go', 'get', './...')
return code: 1
expected return code: 0
stdout:
    Executable `go` not found
stderr: (none)

Solution

  • for whatever reason it looks like talisman incorrectly installs as an executable named cmd instead of talisman when installed from source

    I would suggest sending a pull request to correct this code here to use entry: cmd --githook pre-commit (as well as below in that file)

    a workaround is to override the incorrect value directly in your configuration:

    repos:
    -   repo: https://github.com/thoughtworks/talisman
        rev: v1.22.0
        hooks:
        -   id: talisman-commit
            entry: cmd --githook pre-commit
    

    this seems to have regressed at some point, perhaps during a refactor / reorganization of their code -- probably in this commit


    disclaimer: I created pre-commit