Skip to content

Commit

Permalink
Merge pull request #10 from pjanotti/make-individual-pkgs
Browse files Browse the repository at this point in the history
Make individual packages on the repo
  • Loading branch information
Paulo Janotti authored Aug 5, 2019
2 parents 0db1bfa + f3c1c94 commit 69c014f
Show file tree
Hide file tree
Showing 10 changed files with 619 additions and 373 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# GoLand IDEA
/.idea/

# VS Code
.vscode

# Emacs
*~
\#*\#

# Miscellaneous files
*.sw[op]
*.DS_Store

# Coverage
coverage.txt
coverage.html
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
EXPORTERS := $(wildcard exporter/*/.)

.DEFAULT_GOAL := all

.PHONY: all $(EXPORTERS)
all: $(EXPORTERS)
$(EXPORTERS):
$(MAKE) -C $@

.PHONY: install-tools
install-tools:
GO111MODULE=on go install \
github.com/google/addlicense \
golang.org/x/lint/golint \
golang.org/x/tools/cmd/goimports \
github.com/client9/misspell/cmd/misspell \
honnef.co/go/tools/cmd/staticcheck
101 changes: 101 additions & 0 deletions Makefile.Common
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# More exclusions can be added similar with: -not -path './vendor/*'
ALL_SRC := $(shell find . -name '*.go' \
-not -path './vendor/*' \
-type f | sort)

# All source code and documents. Used in spell check.
ALL_SRC_AND_DOC := $(shell find . \( -name "*.md" -o -name "*.go" -o -name "*.yaml" \) \
-not -path './vendor/*' \
-type f | sort)

# ALL_PKGS is used with 'go cover'
ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))

GOTEST_OPT?= -race -timeout 30s
GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic
GOTEST=go test
GOFMT=gofmt
GOIMPORTS=goimports
GOLINT=golint
GOVET=go vet
GOOS=$(shell go env GOOS)
ADDLICENCESE= addlicense
MISSPELL=misspell -error
MISSPELL_CORRECTION=misspell -w
STATICCHECK=staticcheck

all-pkgs:
@echo $(ALL_PKGS) | tr ' ' '\n' | sort

all-srcs:
@echo $(ALL_SRC) | tr ' ' '\n' | sort

.DEFAULT_GOAL := addlicense-fmt-vet-lint-goimports-misspell-staticcheck-test

.PHONY: addlicense-fmt-vet-lint-goimports-misspell-staticcheck-test
addlicense-fmt-vet-lint-goimports-misspell-staticcheck-test: addlicense fmt vet lint goimports misspell staticcheck test

.PHONY: test
test:
$(GOTEST) $(GOTEST_OPT) $(ALL_PKGS)

.PHONY: addlicense
addlicense:
@ADDLICENCESEOUT=`$(ADDLICENCESE) -y 2019 -c 'OpenTelemetry Authors' $(ALL_SRC) 2>&1`; \
if [ "$$ADDLICENCESEOUT" ]; then \
echo "$(ADDLICENCESE) FAILED => add License errors:\n"; \
echo "$$ADDLICENCESEOUT\n"; \
exit 1; \
else \
echo "Add License finished successfully"; \
fi

.PHONY: fmt
fmt:
@FMTOUT=`$(GOFMT) -s -l $(ALL_SRC) 2>&1`; \
if [ "$$FMTOUT" ]; then \
echo "$(GOFMT) FAILED => gofmt the following files:\n"; \
echo "$$FMTOUT\n"; \
exit 1; \
else \
echo "Fmt finished successfully"; \
fi

.PHONY: lint
lint:
@LINTOUT=`$(GOLINT) $(ALL_PKGS) 2>&1`; \
if [ "$$LINTOUT" ]; then \
echo "$(GOLINT) FAILED => clean the following lint errors:\n"; \
echo "$$LINTOUT\n"; \
exit 1; \
else \
echo "Lint finished successfully"; \
fi

.PHONY: goimports
goimports:
@IMPORTSOUT=`$(GOIMPORTS) -d . 2>&1`; \
if [ "$$IMPORTSOUT" ]; then \
echo "$(GOIMPORTS) FAILED => fix the following goimports errors:\n"; \
echo "$$IMPORTSOUT\n"; \
exit 1; \
else \
echo "Goimports finished successfully"; \
fi

.PHONY: misspell
misspell:
$(MISSPELL) $(ALL_SRC_AND_DOC)

.PHONY: misspell-correction
misspell-correction:
$(MISSPELL_CORRECTION) $(ALL_SRC_AND_DOC)

.PHONY: staticcheck
staticcheck:
$(STATICCHECK) ./...

.PHONY: vet
vet:
@$(GOVET) ./...
@echo "Vet finished successfully"
1 change: 1 addition & 0 deletions exporter/stackdriverexporter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
11 changes: 11 additions & 0 deletions exporter/stackdriverexporter/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/open-telemetry/opentelemetry-service-contrib/exporter/stackdriverexporter

go 1.12

require (
contrib.go.opencensus.io/exporter/stackdriver v0.12.4
github.com/open-telemetry/opentelemetry-service v0.0.0-20190802182013-b39842ba580b
github.com/stretchr/testify v1.3.0
go.opencensus.io v0.22.0
go.uber.org/zap v1.10.0
)
418 changes: 418 additions & 0 deletions exporter/stackdriverexporter/go.sum

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions exporter/stackdriverexporter/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ import (
"github.com/open-telemetry/opentelemetry-service/exporter/exporterwrapper"
)

type stackdriverConfig struct {
ProjectID string `mapstructure:"project,omitempty"`
EnableTracing bool `mapstructure:"enable-tracing,omitempty"`
EnableMetrics bool `mapstructure:"enable-metrics,omitempty"`
MetricPrefix string `mapstructure:"metric-prefix,omitempty"`
}

// TODO: Add metrics support to the exporterwrapper.
type stackdriverExporter struct {
exporter *stackdriver.Exporter
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/open-telemetry/opentelemetry-service-contrib
module github.com/open-telemetry/opentelemetry-service-contrib/exporter

go 1.12

require (
contrib.go.opencensus.io/exporter/stackdriver v0.12.2
github.com/open-telemetry/opentelemetry-service v0.0.0-20190726175643-11a0a2ab4e8b
github.com/stretchr/testify v1.3.0
go.opencensus.io v0.22.0
go.uber.org/zap v1.10.0
github.com/client9/misspell v0.3.4 // indirect
github.com/google/addlicense v0.0.0-20190510175307-22550fa7c1b0 // indirect
golang.org/x/lint v0.0.0-20190409202823-959b441ac422 // indirect
golang.org/x/tools v0.0.0-20190805165405-2756c524cc1c // indirect
honnef.co/go/tools v0.0.1-2019.2.2 // indirect
)
Loading

0 comments on commit 69c014f

Please sign in to comment.