Skip to content

ruleguard fails with many "undefined" errors #15

@jdpedrie

Description

@jdpedrie

Running ruleguard -rules lint.go ./... completes with no errors. However, when running the pre-commit hook below, I get many errors about undefined variables and types, and the execution fails.

  - repo: https://github.com/Bahjat/pre-commit-golang
    rev: v1.0.3
    hooks:
      - id: go-lint
      - id: go-static-check
      - id: golangci-lint
        args: [--config=.golangci.yml]
      - id: go-ruleguard
        args: [lint.go]

Sample of the errors:

/Users/jdp/dev/bin/ruleguard
-: # command-line-arguments
pkg/user/repository.go:28:43: undefined: User
pkg/user/repository.go:31:49: undefined: User
pkg/user/repository.go:34:36: undefined: User
pkg/user/repository.go:37:38: undefined: User
pkg/user/repository.go:41:69: undefined: BuilderMap
pkg/user/repository.go:52:10: undefined: BuilderMap
pkg/user/repository.go:103:63: undefined: User
pkg/user/repository.go:198:69: undefined: User
pkg/user/repository.go:216:56: undefined: User
pkg/user/repository.go:239:58: undefined: User
pkg/user/repository.go:239:58: too many errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions