~rjarry/aerc

6d59ad3f02bc97c0b5040f59259fa8450702a2e2 — Moritz Poldrack 14 days ago a3edb98
ci: fix lint if notmuch is not installed

The linter goes completely crazy when notmuch is not installed and the
notmuch build tag is enabled. With an otherwise successful lint, the
following output is generated:

worker/notmuch/lib/database.go:14:10: could not import github.com/zenhack/go.notmuch (-: # github.com/zenhack/go.notmuch
../../go/pkg/mod/github.com/brunnre8/go.notmuch@v0.0.0-20201126061756-caa2daf7093c/configList.go:9:11: fatal error: notmuch.h: No such file or directory
    9 | // #include <notmuch.h>
      |           ^~~~~~~~~~~
compilation terminated.) (typecheck)
        notmuch "github.com/zenhack/go.notmuch"
               ^
commands/eml.go:4:2: "bytes" imported and not used (typecheck)
        "bytes"
        ^
aerc.go:39:7: previous case (typecheck)
        case *widgets.AccountView:
            ^
exit status 1
make: *** [Makefile:73: lint] Error 1

Only include the notmuch build tag in the lint process if it is actually
installed.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
2 files changed, 2 insertions(+), 3 deletions(-)

M .golangci.toml
M Makefile
M .golangci.toml => .golangci.toml +0 -2
@@ 1,6 1,4 @@
[run]
# include notmuch codes
build-tags = ["notmuch"]
# don't lint tests
tests = false


M Makefile => Makefile +2 -1
@@ 73,7 73,8 @@ lint: linters.so
	@$(GO) run mvdan.cc/gofumpt@$(gofumpt_tag) -d . | grep ^ \
		&& echo The above files need to be formatted, please run make fmt && exit 1 \
		|| echo all files formatted.
	$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 run
	$(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 run \
		$$(echo $(GOFLAGS) | sed s/-tags=/--build-tags=/)

.PHONY: vulncheck
vulncheck: