Skip to content

Commit

Permalink
feat: add 'make bazel.lint' (actually slower than with go)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Oct 15, 2019
1 parent b20d2dc commit e08cdd7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
13 changes: 13 additions & 0 deletions go/BUILD.bazel
Expand Up @@ -7,3 +7,16 @@ gazelle(
name = "gazelle",
external = "vendored",
)

load("@com_github_atlassian_bazel_tools//golangcilint:def.bzl", "golangcilint")

golangcilint(
name = "golangcilint",
config = "//:.golangci.yml",
paths = [
"cmd/...",
"pkg/...",
"internal/...",
],
prefix = "berty.tech/go",
)
19 changes: 14 additions & 5 deletions go/Makefile
Expand Up @@ -41,6 +41,9 @@ dev: ibazel.daemon
.PHONY: test
test: unittest lint tidy

.PHONY: lint
lint: go.lint

.PHONY: autotest
autotest: ibazel.unittest

Expand All @@ -50,11 +53,6 @@ unittest: bazel.unittest
.PHONY: generate
generate: pb.generate

.PHONY: lint
lint: pb.generate
$(call check-program, golangci-lint)
golangci-lint run --verbose ./...

.PHONY: tidy
tidy: pb.generate
$(call check-program, $(GO))
Expand All @@ -79,6 +77,11 @@ re: clean build
## Go rules (without bazel)
##

.PHONY: go.lint
go.lint: pb.generate
$(call check-program, golangci-lint)
golangci-lint run --verbose ./...

.PHONY: nobazel.unittest
go.unittest: pb.generate
$(call check-program, $(GO))
Expand All @@ -96,6 +99,12 @@ go.install: pb.generate
SAMPLE_GAZELLE_GENERATED_FILE ?= pkg/bertyprotocol/BUILD.bazel # should be the path of a git-ignored bazel-generated file
VENDOR_BAZEL_OVERRIDEN_FILES = vendor/github.com/spacemonkeygo/openssl/BUILD.bazel


.PHONY: bazel.lint
bazel.lint: pb.generate
$(call check-program, $(BAZEL))
$(BAZEL_WRAPPER) $(BAZEL_ARGS) run //:golangcilint

.PHONY: bazel.build
bazel.build: bazel.generate
$(call check-program, $(BAZEL))
Expand Down
10 changes: 10 additions & 0 deletions go/WORKSPACE
Expand Up @@ -44,6 +44,16 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

gazelle_dependencies()

# golangci-lint

http_archive(
name = "com_github_atlassian_bazel_tools",
strip_prefix = "bazel-tools-a2138311856f55add11cd7009a5abc8d4fd6f163",
urls = ["https://github.com/atlassian/bazel-tools/archive/a2138311856f55add11cd7009a5abc8d4fd6f163.zip"],
)
load("@com_github_atlassian_bazel_tools//golangcilint:deps.bzl", "golangcilint_dependencies")
golangcilint_dependencies()

# grpc

go_repository(
Expand Down
2 changes: 1 addition & 1 deletion go/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e08cdd7

Please sign in to comment.