On 5/21/2024 12:48 PM,
andrew.p...@gmail.com wrote:
> Please simplify both of these, so that the user can simply run:
>
> go vet -vettool=shadow
>
> Or:
>
> shadow ./...
> In other words, the user should be able to invoke gofmt on a large Go
> project with:
>
> gofmt ./...
>
> Same request for goimports.
>
The "./..." syntax matches packages, not files and that's why tools
which work on files doesn't accept this syntax. The "go" program already
has "fmt" sub-command that do exactly this, run gofmt recursively on all
matched packages sources, so try "go fmt ./...". Analyzers already
accept packages and not files, so "shadow ./..." should work.
I think taking files instead of packages is somewhat legacy, but I found
it's useful, since we moved from GOPATH to go modules resolving packages
is somehow slow, I definitely feel a delay when using programs that
takes packages as an argument, that's very noticeable when you're in a
slow filesystem or storage device, so gofmt not taking 5 seconds (unlike
go fmt) to run is a good feature.
-w