diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-15 13:29:17 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-18 16:36:36 +0300 |
commit | 4048d0cd096af6329922a67fc5ddc9e6e8a39a04 (patch) | |
tree | 5dd68840ef0e13609f7f9cbfee89298a4fc374df | |
parent | eb8e49f60bbf8c1fa7b52c51235655b6b992e969 (diff) |
Makefile: Run goimports only once
As part of the `format` Makefile target we also run `goimports` to
automatically fix up missing or superfluous imports. Because of the way
`goimports` adds these imports, the end result may not conform to the
code style as dictated by `gofumpt`. To fix any formatting differences,
we call `goimports` twice: once before, and once after `gofumpt`.
This doesn't really make a lot of sense though: executing it once before
the formatter runs should be sufficient. For it to not be sufficient the
formatter would have to remove imports again, and this is something I'd
claim doesn't happen.
Remove the second call to `goimports` to speed up the `format` target.
-rw-r--r-- | Makefile | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -464,7 +464,6 @@ format: ${GOIMPORTS} ${GOFUMPT} ${Q}# an exit code of 1 in case it didn.t match anything we also need to filter ${Q}# that code to not cause this recipe to fail in the general case. ${Q}${GOFUMPT} -w $(call find_go_sources) 2>&1 | ( grep -v '^${SOURCE_DIR}/[^[:space:]]*\.go$$' || test $$? = 1 ) - ${Q}${GOIMPORTS} -w -l $(call find_go_sources) .PHONY: notice-up-to-date notice-up-to-date: ${BUILD_DIR}/NOTICE |