Skip to content

Commit

Permalink
Move dependencies of tools package to a tools directory (#466)
Browse files Browse the repository at this point in the history
* Move dependencies of tools package to a tools directory

* remove TOOLS_MOD_DIR from ALL_GO_MOD_DIRS in a Makefile.
then run 'go mod tidy' on ALL_GO_MOD_DIRS and TOOLS_MOD_DIR.

Co-authored-by: Rahul Patel <rghetia@yahoo.com>
  • Loading branch information
theoden9014 and rghetia committed Feb 6, 2020
1 parent cab6b28 commit 4818358
Show file tree
Hide file tree
Showing 16 changed files with 395 additions and 2,590 deletions.
26 changes: 15 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
EXAMPLES := $(shell ./get_main_pkgs.sh ./example)
TOOLS_MOD_DIR := ./tools

# All source code and documents. Used in spell check.
ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
# All directories with go.mod files. Used in go mod tidy.
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example' | sort)
# All directories with go.mod files related to opentelemetry library. Used for building, testing and linting.
ALL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort))
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort)

GOTEST_MIN = go test -v -timeout 30s
GOTEST = $(GOTEST_MIN) -race
Expand All @@ -14,15 +15,18 @@ GOTEST_WITH_COVERAGE = $(GOTEST) -coverprofile=coverage.txt -covermode=atomic

.PHONY: precommit

TOOLS_DIR := ./.tools
TOOLS_DIR := $(abspath ./.tools)

$(TOOLS_DIR)/golangci-lint: go.mod go.sum tools.go
$(TOOLS_DIR)/golangci-lint: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint

$(TOOLS_DIR)/misspell: go.mod go.sum tools.go
$(TOOLS_DIR)/misspell: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/misspell github.com/client9/misspell/cmd/misspell

$(TOOLS_DIR)/stringer: go.mod go.sum tools.go
$(TOOLS_DIR)/stringer: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_MOD_DIR)/tools.go
cd $(TOOLS_MOD_DIR) && \
go build -o $(TOOLS_DIR)/stringer golang.org/x/tools/cmd/stringer

precommit: generate build lint examples test
Expand Down Expand Up @@ -88,15 +92,15 @@ lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "golangci-lint in $${dir}"; \
(cd "$${dir}" && \
$(abspath $(TOOLS_DIR))/golangci-lint run --fix && \
$(abspath $(TOOLS_DIR))/golangci-lint run); \
$(TOOLS_DIR)/golangci-lint run --fix && \
$(TOOLS_DIR)/golangci-lint run); \
done
$(TOOLS_DIR)/misspell -w $(ALL_DOCS)
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
set -e; for dir in $(ALL_GO_MOD_DIRS) $(TOOLS_MOD_DIR); do \
echo "go mod tidy in $${dir}"; \
(cd "$${dir}" && \
go mod tidy); \
done

generate: $(TOOLS_DIR)/stringer
PATH="$(abspath $(TOOLS_DIR)):$${PATH}" go generate ./...
PATH="$(TOOLS_DIR):$${PATH}" go generate ./...
237 changes: 2 additions & 235 deletions example/basic/go.sum

Large diffs are not rendered by default.

242 changes: 5 additions & 237 deletions example/grpc/go.sum

Large diffs are not rendered by default.

221 changes: 4 additions & 217 deletions example/http-stackdriver/go.sum

Large diffs are not rendered by default.

246 changes: 2 additions & 244 deletions example/http/go.sum

Large diffs are not rendered by default.

232 changes: 2 additions & 230 deletions example/jaeger/go.sum

Large diffs are not rendered by default.

237 changes: 2 additions & 235 deletions example/namedtracer/go.sum

Large diffs are not rendered by default.

195 changes: 2 additions & 193 deletions example/prometheus/go.sum

Large diffs are not rendered by default.

195 changes: 2 additions & 193 deletions exporter/metric/prometheus/go.sum

Large diffs are not rendered by default.

233 changes: 2 additions & 231 deletions exporter/trace/jaeger/go.sum

Large diffs are not rendered by default.

221 changes: 4 additions & 217 deletions exporter/trace/stackdriver/go.sum

Large diffs are not rendered by default.

22 changes: 4 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,14 @@ go 1.13
require (
github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7
github.com/benbjohnson/clock v1.0.0
github.com/client9/misspell v0.3.4
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d // indirect
github.com/golangci/golangci-lint v1.21.0
github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/google/go-cmp v0.3.1
github.com/google/gofuzz v1.0.0 // indirect
github.com/gostaticanalysis/analysisutil v0.0.3 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e
github.com/pelletier/go-toml v1.5.0 // indirect
github.com/securego/gosec v0.0.0-20191008095658-28c1128b7336 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/testify v1.4.0
github.com/uudashr/gocognit v1.0.0 // indirect
golang.org/x/sys v0.0.0-20191010194322-b09406accb47 // indirect
golang.org/x/tools v0.0.0-20191025174333-e96d959c4788
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 // indirect
google.golang.org/grpc v1.24.0
mvdan.cc/unparam v0.0.0-20190917161559-b83a221c10a2 // indirect
sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.2.7 // indirect
)
332 changes: 3 additions & 329 deletions go.sum

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module go.opentelemetry.io/otel/tools

go 1.13

require (
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.21.0
golang.org/x/tools v0.0.0-20191025174333-e96d959c4788
)
337 changes: 337 additions & 0 deletions tools/go.sum

Large diffs are not rendered by default.

File renamed without changes.

0 comments on commit 4818358

Please sign in to comment.