When running the make golint
target in opentelemetry-collector-contrib, sometimes a lint error will appear. It seems like the kind of lint-check which could be easily fixed as well, but make gofmt
will not fix such.
Is there a way to use one of the tools vendored by make install-tools
in GIT_REPO_ROOT/.tools
to automatically reformat the project in a way which makes the golangci-lint happy?
-- details --
The specific error is File is not `gci`-ed with --skip-generated -s standard,default,prefix(github.com/open-telemetry/opentelemetry-collector-contrib)
neither make gofmt
, ./.tools/goimports -w -local "github.com/open-telemetry/opentelemetry-collector-contrib"
work for this, and
The particular command in the make target manifesting this problem is .tools/golangci-lint run --allow-parallel-runners --build-tags integration
However, none of these flags seem to be valid for the gci tool
❯ ./.tools/gci --skip-generated -s standard,default,prefix\(github.com/open-telemetry/opentelemetry-collector-contrib\)
Error: unknown flag: --skip-generated
Usage:
gci [-diff | -write] [--local localPackageURLs] path... [flags]
gci [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
diff Prints a git style diff to STDOUT
help Help about any command
print Outputs the formatted file to STDOUT
write Formats the specified files in-place
Flags:
-d, --diff display diffs instead of rewriting files
-h, --help help for gci
-l, --local strings put imports beginning with this string after 3rd-party packages, separate imports by comma
-v, --version version for gci
-w, --write write result to (source) file instead of stdout
Use "gci [command] --help" for more information about a command.
This seems to work, need to add the write command and replace
{}
with your filename