Skip to content

Commit

Permalink
Merge branch 'main' into lint-bare-return
Browse files Browse the repository at this point in the history
  • Loading branch information
FlamingSaint authored Jun 3, 2024
2 parents 2119ecd + c428138 commit 2c7c15f
Show file tree
Hide file tree
Showing 12 changed files with 1,325 additions and 29 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ignore:
- "examples/hotrod"
- "plugin/storage/integration"
- "cmd/jaeger/internal/integration"
- "internal/tools"

coverage:
precision: 2
Expand Down
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ updates:
patterns:
- "go.opentelemetry.io/contrib/instrumentation/*"

- package-ecosystem: gomod
directory: "/internal/tools"
schedule:
interval: daily
labels: [ "changelog:dependencies" ]

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down Expand Up @@ -129,4 +135,4 @@ updates:
interval: daily
allow:
- dependency-name: "bitnami/kafka"
update-types: ["version-update:semver-minor"]
update-types: ["version-update:semver-minor"]
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
go.work
go.work.sum

.tools/

*.out
*.test
*.xml
Expand All @@ -15,6 +17,8 @@ cover.html
.tmp/
.mkdocs-virtual-env/
vendor/

# Jaeger binaries
examples/hotrod/hotrod
examples/hotrod/hotrod-*
cmd/all-in-one/all-in-one-*
Expand All @@ -36,6 +40,7 @@ cmd/query/query-*
cmd/tracegen/tracegen
cmd/tracegen/tracegen-*
crossdock/crossdock-*

run-crossdock.log
proto-gen/.patched-otel-proto/
__pycache__
Expand Down
30 changes: 8 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ JAEGER_V2_STORAGE_PKGS = ./cmd/jaeger/internal/integration
DOCKER_NAMESPACE?=jaegertracing
DOCKER_TAG?=latest

# SRC_ROOT is the top of the source tree.
SRC_ROOT := $(shell git rev-parse --show-toplevel)

# TODO we can compartmentalize this Makefile better, by separting:
# - integration tests
# - all the binary building targets
Expand All @@ -32,6 +35,7 @@ ALL_SRC = $(shell find . -name '*.go' \
-not -name 'mocks*' \
-not -name '*.pb.go' \
-not -path './vendor/*' \
-not -path './internal/tools/*' \
-not -path '*/mocks/*' \
-not -path '*/*-gen/*' \
-not -path '*/thrift-0.9.2/*' \
Expand Down Expand Up @@ -59,7 +63,6 @@ GOTEST_QUIET=$(GO) test $(RACE)
GOTEST=$(GOTEST_QUIET) -v
COVEROUT=cover.out
GOFMT=gofmt
GOFUMPT=gofumpt
FMT_LOG=.fmt.log
IMPORT_LOG=.import.log
COLORIZE ?= | $(SED) 's/PASS/✅ PASS/g' | $(SED) 's/FAIL/❌ FAIL/g' | $(SED) 's/SKIP/🔕 SKIP/g'
Expand All @@ -78,11 +81,10 @@ DATE=$(shell TZ=UTC0 git show --quiet --date='format-local:%Y-%m-%dT%H:%M:%SZ' -
BUILD_INFO_IMPORT_PATH=$(JAEGER_IMPORT_PATH)/pkg/version
BUILD_INFO=-ldflags "-X $(BUILD_INFO_IMPORT_PATH).commitSHA=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).latestVersion=$(GIT_CLOSEST_TAG) -X $(BUILD_INFO_IMPORT_PATH).date=$(DATE)"

MOCKERY=mockery
GOVERSIONINFO=goversioninfo
SYSOFILE=resource.syso

# import other Makefiles after the variables are defined
include Makefile.Tools.mk
include docker/Makefile
include Makefile.Protobuf.mk
include Makefile.Thrift.mk
Expand Down Expand Up @@ -187,7 +189,7 @@ fmt:

.PHONY: lint
lint: goleak
golangci-lint -v run
$(LINT) -v run
@./scripts/updateLicense.py $(ALL_SRC) > $(FMT_LOG)
@./scripts/import-order-cleanup.py -o stdout -t $(ALL_SRC) > $(IMPORT_LOG)
@[ ! -s "$(FMT_LOG)" -a ! -s "$(IMPORT_LOG)" ] || (echo "License check or import ordering failures, run 'make fmt'" | cat - $(FMT_LOG) $(IMPORT_LOG) && false)
Expand Down Expand Up @@ -452,22 +454,6 @@ changelog:
draft-release:
./scripts/draft-release.py

.PHONY: install-test-tools
install-test-tools:
$(GO) install github.com/golangci/golangci-lint/cmd/[email protected]
$(GO) install mvdan.cc/gofumpt@latest

.PHONY: install-build-tools
install-build-tools:
$(GO) install github.com/josephspurrier/goversioninfo/cmd/[email protected]

.PHONY: install-tools
install-tools: install-test-tools install-build-tools
$(GO) install github.com/vektra/mockery/[email protected]

.PHONY: install-ci
install-ci: install-test-tools install-build-tools

.PHONY: test-ci
test-ci: GOTEST := $(GOTEST_QUIET)
test-ci: build-examples cover
Expand All @@ -477,8 +463,8 @@ init-submodules:
git submodule update --init --recursive

.PHONY: generate-mocks
generate-mocks: install-tools
$(MOCKERY) --all --dir ./pkg/es/ --output ./pkg/es/mocks && rm pkg/es/mocks/ClientBuilder.go
generate-mocks: $(MOCKERY)
$(MOCKERY) --all --dir ./pkg/es/ --output ./pkg/es/mocks
$(MOCKERY) --all --dir ./storage/spanstore/ --output ./storage/spanstore/mocks
$(MOCKERY) --all --dir ./proto-gen/storage_v1/ --output ./proto-gen/storage_v1/mocks

Expand Down
39 changes: 39 additions & 0 deletions Makefile.Tools.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2024 The Jaeger Authors.
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

TOOLS_MOD_DIR := $(SRC_ROOT)/internal/tools
TOOLS_BIN_DIR := $(SRC_ROOT)/.tools
TOOLS_MOD_REGEX := "\s+_\s+\".*\""
TOOLS_PKG_NAMES := $(shell grep -E $(TOOLS_MOD_REGEX) < $(TOOLS_MOD_DIR)/tools.go | tr -d " _\"")
TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_PKG_NAMES) | sed 's|/v[0-9]||g')))

GOFUMPT := $(TOOLS_BIN_DIR)/gofumpt
GOVERSIONINFO := $(TOOLS_BIN_DIR)/goversioninfo
LINT := $(TOOLS_BIN_DIR)/golangci-lint
MOCKERY := $(TOOLS_BIN_DIR)/mockery

# this target is useful for setting up local workspace, but from CI we want to call more specific ones
.PHONY: install-tools
install-tools: $(TOOLS_BIN_NAMES)

.PHONY: install-test-tools
install-test-tools: $(LINT) $(GOFUMPT)

.PHONY: install-build-tools
install-build-tools: $(GOVERSIONINFO)

.PHONY: install-ci
install-ci: install-test-tools install-build-tools

list-internal-tools:
@echo Third party tool modules:
@echo $(TOOLS_PKG_NAMES) | tr ' ' '\n' | sed 's/^/- /g'
@echo Third party tool binaries:
@echo $(TOOLS_BIN_NAMES) | tr ' ' '\n' | sed 's/^/- /g'

$(TOOLS_BIN_DIR):
mkdir -p $@

$(TOOLS_BIN_NAMES): $(TOOLS_BIN_DIR) $(TOOLS_MOD_DIR)/go.mod
cd $(TOOLS_MOD_DIR) && $(GO) build -o $@ -trimpath $(shell echo $(TOOLS_PKG_NAMES) | tr ' ' '\n' | grep $(notdir $@))
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/soheilhy/cmux v0.1.5
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/xdg-go/scram v1.1.2
Expand Down Expand Up @@ -150,7 +150,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.101.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
Expand Down Expand Up @@ -386,8 +386,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
6 changes: 6 additions & 0 deletions internal/tools/empty.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2024 The Jaeger Authors.
// SPDX-License-Identifier: Apache-2.0

// Package tools is used to track versions of 3rd party tools used for building / testing CI.
// See tools.go for imported tools and go.mod for the versions of those tools.
package tools
Loading

0 comments on commit 2c7c15f

Please sign in to comment.