Skip to content

Pre-commit installation fails #78

Open
@sgabenov

Description

@sgabenov

It seems like, if i use this tool with pre-commit, it tries to search Go files not in pre-commit .cache directory, but from root path of the repo. Could you please check with some empty git repo to use this pre-commit configuration to get same errors.

After creating .pre-commit-config.yaml and commiting files \ executing pre-commit run

repos:
- repo: https://github.com/hashicorp/copywrite
  rev: v0.16.4
  hooks:
    - id: add-headers
    - id: check-headers

have such error:

Add copyright headers....................................................Failed
- hook id: add-headers
- exit code: 1
go: cannot find main module, but found .git/config in /Users/gabenov/git/sandbox/pre-commit
	to create a module there, run:
	go mod init

or after executing go mod init pre-commit

Validate copyright headers...............................................Failed
- hook id: check-headers
- exit code: 1
no Go files in /Users/gabenov/git/sandbox/pre-commit

version: pre-commit 3.3.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions