Skip to content

Commit

Permalink
Add impi to ensure import organization
Browse files Browse the repository at this point in the history
* add make target to install and run
* add to internal dep and update go.mod
* run and fix issues
* order: std / 3rd party and local

fixes open-telemetry#28
  • Loading branch information
ferhatelmas committed Nov 21, 2019
1 parent 2254e5b commit 26f127d
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 20 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ADDLICENCESE= addlicense
MISSPELL=misspell -error
MISSPELL_CORRECTION=misspell -w
STATICCHECK=staticcheck
IMPI=impi

GIT_SHA=$(shell git rev-parse --short HEAD)
BUILD_INFO_IMPORT_PATH=github.com/open-telemetry/opentelemetry-collector-contrib/internal/version
Expand Down Expand Up @@ -128,14 +129,19 @@ vet:
@$(GOVET) ./...
@echo "Vet finished successfully"

.PHONY: impi
impi:
@$(IMPI) --local github.com/open-telemetry/opentelemetry-collector-contrib --scheme stdThirdPartyLocal ./...

.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
honnef.co/go/tools/cmd/staticcheck \
github.com/pavius/impi/cmd/impi

.PHONY: otelcontribcol
otelcontribcol:
Expand Down
5 changes: 2 additions & 3 deletions exporter/stackdriverexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import (
"path"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-collector/config"
"github.com/open-telemetry/opentelemetry-collector/config/configmodels"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestLoadConfig(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/stackdriverexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
package stackdriverexporter

import (
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector/config/configmodels"
"github.com/open-telemetry/opentelemetry-collector/exporter"
"go.uber.org/zap"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions exporter/stackdriverexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import (
"os"
"testing"

"github.com/open-telemetry/opentelemetry-collector/config/configcheck"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector/config/configcheck"
)

func TestCreateDefaultConfig(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions exporter/stackdriverexporter/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import (
"fmt"

"contrib.go.opencensus.io/exporter/stackdriver"
"google.golang.org/api/option"
"google.golang.org/grpc"

"github.com/open-telemetry/opentelemetry-collector/consumer/consumerdata"
"github.com/open-telemetry/opentelemetry-collector/exporter"
"github.com/open-telemetry/opentelemetry-collector/exporter/exporterhelper"
"github.com/open-telemetry/opentelemetry-collector/oterr"
spandatatranslator "github.com/open-telemetry/opentelemetry-collector/translator/trace/spandata"
"google.golang.org/api/option"
"google.golang.org/grpc"
)

// stackdriverExporter is a wrapper struct of Stackdriver exporter
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191016224815-dfabfb0c1d1e
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/stackdriverexporter v0.0.0-20191021165924-bb954188ac10
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinscribereceiver v0.0.0-20191021165924-bb954188ac10
github.com/pavius/impi v0.0.0-20180302134524-c1cbdcb8df2b // indirect
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac
golang.org/x/tools v0.0.0-20190917162342-3b4f30a44f3b
honnef.co/go/tools v0.0.1-2019.2.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ github.com/orijtech/prometheus-go-metrics-exporter v0.0.3-0.20190313163149-b321c
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pavius/impi v0.0.0-20180302134524-c1cbdcb8df2b h1:yS0+/i6mwRZCdssUd+MkFJkCn/Evh1PlUKCYe3aCtQw=
github.com/pavius/impi v0.0.0-20180302134524-c1cbdcb8df2b/go.mod h1:x/hU0bfdWIhuOT1SKwiJg++yvkk6EuOtJk8WtDZqgr8=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
Expand Down
1 change: 1 addition & 0 deletions internal/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package internal
import (
_ "github.com/client9/misspell/cmd/misspell"
_ "github.com/google/addlicense"
_ "github.com/pavius/impi/cmd/impi"
_ "golang.org/x/lint/golint"
_ "golang.org/x/tools/cmd/goimports"
_ "honnef.co/go/tools/cmd/staticcheck"
Expand Down
5 changes: 2 additions & 3 deletions receiver/zipkinscribereceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import (
"path"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/open-telemetry/opentelemetry-collector/config"
"github.com/open-telemetry/opentelemetry-collector/config/configmodels"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestLoadConfig(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions receiver/zipkinscribereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ package zipkinscribereceiver
import (
"context"

"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector/config/configerror"
"github.com/open-telemetry/opentelemetry-collector/config/configmodels"
"github.com/open-telemetry/opentelemetry-collector/consumer"
"github.com/open-telemetry/opentelemetry-collector/receiver"
"go.uber.org/zap"
)

// This file implements factory for Zipkin-Scribe receiver.
Expand Down
5 changes: 2 additions & 3 deletions receiver/zipkinscribereceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector/config/configcheck"
"github.com/open-telemetry/opentelemetry-collector/config/configerror"
"github.com/open-telemetry/opentelemetry-collector/consumer/consumerdata"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
)

func TestCreateDefaultConfig(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion receiver/zipkinscribereceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/apache/thrift/lib/go/thrift"
"github.com/jaegertracing/jaeger/thrift-gen/zipkincore"
"github.com/omnition/scribe-go/if/scribe/gen-go/scribe"

"github.com/open-telemetry/opentelemetry-collector/consumer"
"github.com/open-telemetry/opentelemetry-collector/observability"
"github.com/open-telemetry/opentelemetry-collector/receiver"
Expand Down

0 comments on commit 26f127d

Please sign in to comment.