Allow relative paths
howardjohn opened this issue · comments
Currently, we have a bunch of rules like
files:
- "!**/pkg/a/**"
- "!**/pkg/b/**"
Ideally we could write something like
files:
- "!./pkg/a/**"
- "!./pkg/b/**"
Or
files:
- "!$root/pkg/a/**"
- "!$root/pkg/b/**"
Where this is relative to is up to debate, but probably the module root makes the most sense?
ps: thanks for the great linter!
I'll see if it is possilbe... I have to turn everything into an absolute path as that is what I am given from golang's tools. A hack would be to expand either .
or $root
with **
but then I feel like it is lying.
I do like the variable approach though! Wonder if $git
could be the root of the git repository and $mod
could be the go module (would need to play around with a mono repo with multiple mod files).
Hi,
it seems that this is necessary for us to be able to use it because we have various directories both in top-level but also in subdirectories.
Example tree:
├── somedir
│ └── some_file.go
└── anotherdir
└── somedir
└── another_file.go
I'd like to only scan somedir/*.go
, but I can't - because I have to specify **/somedir/*.go
and this also matches anotherdir/somedir/*.go
.
Of course, I can add a lot of !
statements to ignore them, but I don't think this is a good way to go.
A hack would be to expand either
.
or$root
with**
but then I feel like it is lying.
Indeed, that would be useless. Wouldn't it be possible to expand .
/$root
(I don't care which one you choose) to the current working directory/root path of the project?
Thanks!