I want to run the gopls analsysers on all the files in my project. I was
hoping something like the following would work:
gopls check ./...
But unfortunately, "gopls check" only works with filenames and the ./... is
for packages.
I really want to only check the files in each package in turn.
I've created the following bash script to do what I need:
https://gist.github.com/JetSetIlly/0cb4fb553df41e7dfba134ec4fb78cc7
Usage: GOPLS_CHECK <PATH> [QUIET]
It works by finding all packages in the specified path and running an
instance of "gopls check" for the files in each package. The number of
"gopls check" running in parallel at any one time is limited to the number
of CPU cores.
By default, the script will print out the names of the packages it is
checking. This can be suppressed with the optional QUIET argument. When
QUIET is set then only the output from gopls itself is printed.
Besides gopls, all commands should be available on any system with bash
installed (xargs, dirname, etc.)
A simpler way of doing this would be to pass every file in the entire
project to "gopls check" in one gulp. This didn't work well for me,
seemingly because of the presence of build tags in some of my packages. The
method described above works better for my purposes.
I'm posting because I thought that it might be useful to other people. I'm
also curious if there are existing solutions. I was surprised at not being
able to find an existing way to run the gopls analysers in this fashion.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/56891489-8158-4ad7-9169-545618d8e283n%40googlegroups.com.