dnephin / pre-commit-golang

Golang hooks for pre-commit
MIT License
656 stars 222 forks source link

pass current directory golangci-lint when specifying a configfile #79

Open FalcoSuessgott opened 2 years ago

FalcoSuessgott commented 2 years ago
  # golang pre commits
  - repo: https://github.com/dnephin/pre-commit-golang
    rev: v0.4.0
    hooks:
        - id: go-fmt
        - id: go-vet
        - id: go-lint
        - id: go-imports
        - id: no-go-testing
        - id: golangci-lint
          args: ["-vc .golang-ci.yml"]

results in

ERRO Can't read config: can't read viper config: open .golang-ci.yml: no such file or directory

is there anyway I can prepend $PWD to golangci lint pre commit hook?

FalcoSuessgott commented 2 years ago

Okay even with the fullpath its failing:

ERRO Can't read config: can't read viper config: open /home/..../.golang-ci.yml: no such file or directory

is there anything im doing wrong rofl?

my config:

linters-settings:
  lll:
    line-length: 130
linters:
  enable-all: true
  disable:
    - testpackage
    - forbidigo
    - paralleltest
    - errcheck
    - exhaustivestruct