Skip to content

Commit

Permalink
Move tools to internal, create module to avoid dependency problems (#…
Browse files Browse the repository at this point in the history
…2131)

* Move tools to internal, create module to avoid dependency problems

This way we avoid dependency conflicts between tools and main codebase.

Signed-off-by: Bogdan Drutu <[email protected]>

* Add dependabot entry for the new module

Signed-off-by: Bogdan Drutu <[email protected]>

* Fix build

Signed-off-by: Bogdan Drutu <[email protected]>

* Add makefile in internal/tools

Signed-off-by: Bogdan Drutu <[email protected]>

* Re-enable coverage

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Nov 19, 2020
1 parent 16a257f commit d885cb2
Show file tree
Hide file tree
Showing 10 changed files with 749 additions and 277 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ updates:
interval: "daily"
assignees:
- "bogdandrutu"
- package-ecosystem: "gomod"
directory: "/internal/tools"
schedule:
interval: "daily"
# Add assignees
assignees:
- "bogdandrutu"
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ run:
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
modules-download-mode: readonly
# TODO: re-enable after understanding the issue:
# ERRO Running error: context loading failed: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: build flag -mod=readonly only valid when using modules
# modules-download-mode: readonly

# output configuration options
output:
Expand Down
27 changes: 16 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ include ./Makefile.Common
ALL_SRC := $(shell find . -name '*.go' \
-not -path './cmd/issuegenerator/*' \
-not -path './cmd/mdatagen/*' \
-not -path './internal/tools/*' \
-not -path './examples/demo/app/*' \
-not -path '*/internal/data/opentelemetry-proto-gen/*' \
-not -path './internal/data/opentelemetry-proto-gen/*' \
-type f | sort)

# ALL_PKGS is the list of all packages where ALL_SRC files reside.
Expand All @@ -19,6 +20,8 @@ ALL_DOC := $(shell find . \( -name "*.md" -o -name "*.yaml" \) \
ALL_MODULES := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort | egrep '^./' )

CMD?=
TOOLS_MOD_DIR := ./internal/tools

GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
# BUILD_TYPE should be one of (dev, release).
Expand Down Expand Up @@ -78,6 +81,7 @@ gobenchmark:
@$(MAKE) for-all CMD="make benchmark"

.PHONY: gotest-with-cover
gotest-with-cover:
@echo pre-compiling tests
@time $(GOTEST) -i ./...
$(GO_ACC) ./...
Expand Down Expand Up @@ -113,16 +117,17 @@ gofmt:

.PHONY: install-tools
install-tools:
go install github.com/client9/misspell/cmd/misspell
go install github.com/golangci/golangci-lint/cmd/golangci-lint
go install github.com/google/addlicense
go install github.com/jstemmer/go-junit-report
go install github.com/mjibson/esc
go install github.com/ory/go-acc
go install github.com/pavius/impi/cmd/impi
go install github.com/tcnksm/ghr
go install golang.org/x/tools/cmd/goimports
go install honnef.co/go/tools/cmd/staticcheck
cd $(TOOLS_MOD_DIR) && go install github.com/client9/misspell/cmd/misspell
cd $(TOOLS_MOD_DIR) && go install github.com/golangci/golangci-lint/cmd/golangci-lint
cd $(TOOLS_MOD_DIR) && go install github.com/google/addlicense
cd $(TOOLS_MOD_DIR) && go install github.com/jstemmer/go-junit-report
cd $(TOOLS_MOD_DIR) && go install github.com/mjibson/esc
cd $(TOOLS_MOD_DIR) && go install github.com/ory/go-acc
cd $(TOOLS_MOD_DIR) && go install github.com/pavius/impi/cmd/impi
cd $(TOOLS_MOD_DIR) && go install github.com/securego/gosec/v2/cmd/gosec
cd $(TOOLS_MOD_DIR) && go install github.com/tcnksm/ghr
cd $(TOOLS_MOD_DIR) && go install golang.org/x/tools/cmd/goimports
cd $(TOOLS_MOD_DIR) && go install honnef.co/go/tools/cmd/staticcheck
cd cmd/mdatagen && go install ./

.PHONY: otelcol
Expand Down
20 changes: 9 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,58 @@ require (
contrib.go.opencensus.io/exporter/prometheus v0.2.0
github.com/OneOfOne/xxhash v1.2.5 // indirect
github.com/Shopify/sarama v1.27.2
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/antonmedv/expr v1.8.9
github.com/apache/thrift v0.13.0
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/census-instrumentation/opencensus-proto v0.3.0
github.com/client9/misspell v0.3.4
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/davecgh/go-spew v1.1.1
github.com/go-kit/kit v0.10.0
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/gogo/googleapis v1.3.0 // indirect
github.com/gogo/protobuf v1.3.1
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/protobuf v1.4.3
github.com/golang/snappy v0.0.2
github.com/golangci/golangci-lint v1.31.0
github.com/google/addlicense v0.0.0-20200622132530-df58acafd6d5
github.com/google/go-cmp v0.5.3
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/jaegertracing/jaeger v1.21.0
github.com/jstemmer/go-junit-report v0.9.1
github.com/leoluk/perflib_exporter v0.1.0
github.com/mjibson/esc v0.2.0
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mitchellh/mapstructure v1.3.2 // indirect
github.com/onsi/ginkgo v1.14.1 // indirect
github.com/onsi/gomega v1.10.2 // indirect
github.com/openzipkin/zipkin-go v0.2.5
github.com/orijtech/prometheus-go-metrics-exporter v0.0.6
github.com/ory/go-acc v0.2.6
github.com/pavius/impi v0.0.3
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/pquerna/cachecontrol v0.0.0-20200819021114-67c6ae64274f // indirect
github.com/prometheus/client_golang v1.8.0
github.com/prometheus/common v0.14.0
github.com/prometheus/prometheus v1.8.2-0.20201105135750-00f16d1ac3a4
github.com/rs/cors v1.7.0
github.com/securego/gosec/v2 v2.5.0
github.com/shirou/gopsutil v3.20.10+incompatible
github.com/soheilhy/cmux v0.1.4
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.1.1
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
github.com/tcnksm/ghr v0.13.0
github.com/tinylib/msgp v1.1.4
github.com/uber/jaeger-lib v2.4.0+incompatible
go.opencensus.io v0.22.5
go.uber.org/atomic v1.7.0
go.uber.org/zap v1.16.0
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211
golang.org/x/text v0.3.4
golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d
google.golang.org/grpc v1.33.2
google.golang.org/grpc/examples v0.0.0-20200728065043-dfc0c05b2da9 // indirect
google.golang.org/protobuf v1.25.0
gopkg.in/ini.v1 v1.57.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/yaml.v2 v2.3.0
honnef.co/go/tools v0.0.1-2020.1.6
honnef.co/go/tools v0.0.1-2020.1.6 // indirect
)
Loading

0 comments on commit d885cb2

Please sign in to comment.