how to run go-unit-tests pre-commit hook to run with option -p


I was looking into this golang-precommit hooks repository:

go-unit-tests hook runs the command go test -tags=unit -timeout 30s -short -v but what if I want go hook to run command with
-p=1 option. Is there any way to achieve this?

Here’s the content from my .pre-commit-config.yaml file

  - repo:
    rev: v0.4.0
      - id: go-fmt
      - id: go-unit-tests


there isn’t given that hook directly, but that repo isn’t really adding too terribly much, you could replicate what you want via a repo: local hook (untested):

-   repo: local
    -   id: go-unit-tests
        name: go unit tests
        entry: go test -p=1 ./...
        pass_filenames: false
        types: [go]
        language: system

disclaimer: I wrote pre-commit

Answered By – Anthony Sottile

Answer Checked By – David Marino (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.