pre-commit-golang icon indicating copy to clipboard operation
pre-commit-golang copied to clipboard

pass current directory golangci-lint when specifying a configfile

Open FalcoSuessgott opened this issue 3 years ago • 1 comments

  # 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 avatar Nov 24 '21 10:11 FalcoSuessgott

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

FalcoSuessgott avatar Nov 24 '21 10:11 FalcoSuessgott