From 19b7b7dd3c7dab2d87c354af779556351106d39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sun, 26 Sep 2021 00:11:32 +0200 Subject: [PATCH 01/10] chore: adds vanity import check. --- Makefile | 4 ++++ attribute/type_string.go | 2 +- baggage/baggage.go | 2 +- bridge/opencensus/aggregation.go | 2 +- bridge/opencensus/bridge.go | 2 +- bridge/opencensus/exporter.go | 2 +- example/passthrough/handler/handler.go | 2 +- internal/tools/go.mod | 1 + internal/tools/go.sum | 2 ++ internal/tools/tools.go | 2 ++ metric/number/kind_string.go | 2 +- metric/sdkapi/instrumentkind_string.go | 2 +- sdk/export/metric/exportkind_string.go | 2 +- sdk/trace/event.go | 2 +- sdk/trace/snapshot.go | 2 +- semconv/v1.4.0/exception.go | 2 +- semconv/v1.4.0/schema.go | 2 +- trace/tracestate.go | 2 +- 18 files changed, 23 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index d5f52c638a0..656b3469c44 100644 --- a/Makefile +++ b/Makefile @@ -136,6 +136,10 @@ lint: misspell lint-modules | $(GOLANGCI_LINT) $(GOLANGCI_LINT) run); \ done +.PHONY: vanity-import-check +vanity-import-check: + porto -l . + .PHONY: misspell misspell: | $(MISSPELL) $(MISSPELL) -w $(ALL_DOCS) diff --git a/attribute/type_string.go b/attribute/type_string.go index e584b24776b..642e269516b 100644 --- a/attribute/type_string.go +++ b/attribute/type_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=Type"; DO NOT EDIT. -package attribute +package attribute // import "go.opentelemetry.io/otel/attribute" import "strconv" diff --git a/baggage/baggage.go b/baggage/baggage.go index 8de2bc9df12..3427c51b477 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package baggage +package baggage // import "go.opentelemetry.io/otel/baggage" import ( "errors" diff --git a/bridge/opencensus/aggregation.go b/bridge/opencensus/aggregation.go index a93f36065e6..44015d96cd9 100644 --- a/bridge/opencensus/aggregation.go +++ b/bridge/opencensus/aggregation.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package opencensus +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" import ( "errors" diff --git a/bridge/opencensus/bridge.go b/bridge/opencensus/bridge.go index b30dab57ae9..7e6f31202d6 100644 --- a/bridge/opencensus/bridge.go +++ b/bridge/opencensus/bridge.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package opencensus +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" import ( octrace "go.opencensus.io/trace" diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index 4e3824a610c..c78b84fc740 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package opencensus +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" import ( "context" diff --git a/example/passthrough/handler/handler.go b/example/passthrough/handler/handler.go index 4b8f7a53306..10664baec6f 100644 --- a/example/passthrough/handler/handler.go +++ b/example/passthrough/handler/handler.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package handler +package handler // import "go.opentelemetry.io/otel/example/passthrough/handler" import ( "context" diff --git a/internal/tools/go.mod b/internal/tools/go.mod index cd7f8f662e4..95d90c95e21 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -7,6 +7,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.42.1 github.com/itchyny/gojq v0.12.5 + github.com/jcchavezs/porto v0.2.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210730171444-520d53fe242d golang.org/x/tools v0.1.5 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 7a916472b28..683fe0d7202 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -378,6 +378,8 @@ github.com/itchyny/gojq v0.12.5 h1:6SJ1BQ1VAwJAlIvLSIZmqHP/RUEq3qfVWvsRxrqhsD0= github.com/itchyny/gojq v0.12.5/go.mod h1:3e1hZXv+Kwvdp6V9HXpVrvddiHVApi5EDZwS+zLFeiE= github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= +github.com/jcchavezs/porto v0.2.0 h1:B+ghuY0E2cRQpMp+y7/cBEVVlkA7/5DvhMAGdvcqzW0= +github.com/jcchavezs/porto v0.2.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 7e34a6be860..05095dcf66f 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build tools // +build tools package tools @@ -21,6 +22,7 @@ import ( _ "github.com/gogo/protobuf/protoc-gen-gogofast" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" _ "github.com/itchyny/gojq" + _ "github.com/jcchavezs/porto/cmd/porto" _ "github.com/wadey/gocovmerge" _ "go.opentelemetry.io/build-tools/semconvgen" _ "golang.org/x/tools/cmd/stringer" diff --git a/metric/number/kind_string.go b/metric/number/kind_string.go index 6288c7ea295..13b6a902962 100644 --- a/metric/number/kind_string.go +++ b/metric/number/kind_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=Kind"; DO NOT EDIT. -package number +package number // import "go.opentelemetry.io/otel/metric/number" import "strconv" diff --git a/metric/sdkapi/instrumentkind_string.go b/metric/sdkapi/instrumentkind_string.go index 3a2e79d823e..bffa1584cc9 100644 --- a/metric/sdkapi/instrumentkind_string.go +++ b/metric/sdkapi/instrumentkind_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=InstrumentKind"; DO NOT EDIT. -package sdkapi +package sdkapi // import "go.opentelemetry.io/otel/metric/sdkapi" import "strconv" diff --git a/sdk/export/metric/exportkind_string.go b/sdk/export/metric/exportkind_string.go index a92c1c1f2de..3a04abdd575 100644 --- a/sdk/export/metric/exportkind_string.go +++ b/sdk/export/metric/exportkind_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=ExportKind"; DO NOT EDIT. -package metric +package metric // import "go.opentelemetry.io/otel/sdk/export/metric" import "strconv" diff --git a/sdk/trace/event.go b/sdk/trace/event.go index 4eb556c53be..1e3b426757d 100644 --- a/sdk/trace/event.go +++ b/sdk/trace/event.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package trace +package trace // import "go.opentelemetry.io/otel/sdk/trace" import ( "time" diff --git a/sdk/trace/snapshot.go b/sdk/trace/snapshot.go index 68670bb0b54..53aac61f5fe 100644 --- a/sdk/trace/snapshot.go +++ b/sdk/trace/snapshot.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package trace +package trace // import "go.opentelemetry.io/otel/sdk/trace" import ( "time" diff --git a/semconv/v1.4.0/exception.go b/semconv/v1.4.0/exception.go index ee13cfdbdfe..311cbf218fe 100644 --- a/semconv/v1.4.0/exception.go +++ b/semconv/v1.4.0/exception.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" const ( // ExceptionEventName is the name of the Span event representing an exception. diff --git a/semconv/v1.4.0/schema.go b/semconv/v1.4.0/schema.go index 41079980eca..467a30b9ed7 100644 --- a/semconv/v1.4.0/schema.go +++ b/semconv/v1.4.0/schema.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package semconv +package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare diff --git a/trace/tracestate.go b/trace/tracestate.go index f457466a2a8..9fad16fd277 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package trace +package trace // import "go.opentelemetry.io/otel/trace" import ( "encoding/json" From 2feeef236baf1f3e184643264094e0d8bd90f887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sun, 26 Sep 2021 00:30:29 +0200 Subject: [PATCH 02/10] chore: runs vanity import check on ci. --- .github/workflows/ci.yml | 214 +++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddb5e79b982..6c36bb1f944 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,96 +13,96 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2.1.4 - with: - go-version: ${{ env.DEFAULT_GO_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v2 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - name: Module cache - uses: actions/cache@v2.1.6 - env: - cache-name: go-mod-cache - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} - - name: Tools cache - uses: actions/cache@v2.1.6 - env: - cache-name: go-tools-cache - with: - path: ~/.tools - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} - - name: Run linters - run: make dependabot-check license-check lint - - name: Build - run: make examples build - - name: Check clean repository - run: make check-clean-work-tree + - name: Install Go + uses: actions/setup-go@v2.1.4 + with: + go-version: ${{ env.DEFAULT_GO_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + - name: Module cache + uses: actions/cache@v2.1.6 + env: + cache-name: go-mod-cache + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + - name: Tools cache + uses: actions/cache@v2.1.6 + env: + cache-name: go-tools-cache + with: + path: ~/.tools + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} + - name: Run linters + run: make dependabot-check license-check lint check-vanity-import + - name: Build + run: make examples build + - name: Check clean repository + run: make check-clean-work-tree test-race: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2.1.4 - with: - go-version: ${{ env.DEFAULT_GO_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v2 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - name: Module cache - uses: actions/cache@v2.1.6 - env: - cache-name: go-mod-cache - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} - - name: Run tests with race detector - run: make test-race + - name: Install Go + uses: actions/setup-go@v2.1.4 + with: + go-version: ${{ env.DEFAULT_GO_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + - name: Module cache + uses: actions/cache@v2.1.6 + env: + cache-name: go-mod-cache + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + - name: Run tests with race detector + run: make test-race test-coverage: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v2.1.4 - with: - go-version: ${{ env.DEFAULT_GO_VERSION }} - - name: Checkout Repo - uses: actions/checkout@v2 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - name: Module cache - uses: actions/cache@v2.1.6 - env: - cache-name: go-mod-cache - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} - - name: Run coverage tests - run: | - make test-coverage - mkdir $TEST_RESULTS - cp coverage.out $TEST_RESULTS - cp coverage.txt $TEST_RESULTS - cp coverage.html $TEST_RESULTS - - name: Upload coverage report - uses: codecov/codecov-action@v2.0.3 - with: - file: ./coverage.txt - fail_ci_if_error: true - verbose: true - - name: Store coverage test output - uses: actions/upload-artifact@v2 - with: + - name: Install Go + uses: actions/setup-go@v2.1.4 + with: + go-version: ${{ env.DEFAULT_GO_VERSION }} + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + - name: Module cache + uses: actions/cache@v2.1.6 + env: + cache-name: go-mod-cache + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + - name: Run coverage tests + run: | + make test-coverage + mkdir $TEST_RESULTS + cp coverage.out $TEST_RESULTS + cp coverage.txt $TEST_RESULTS + cp coverage.html $TEST_RESULTS + - name: Upload coverage report + uses: codecov/codecov-action@v2.0.3 + with: + file: ./coverage.txt + fail_ci_if_error: true + verbose: true + - name: Store coverage test output + uses: actions/upload-artifact@v2 + with: name: opentelemetry-go-test-output path: ${{ env.TEST_RESULTS }} @@ -117,30 +117,30 @@ jobs: # https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow arch: ["386", amd64] exclude: - # Not a supported Go OS/architecture. - - os: macos-latest - arch: "386" + # Not a supported Go OS/architecture. + - os: macos-latest + arch: "386" runs-on: ${{ matrix.os }} steps: - - name: Install Go - uses: actions/setup-go@v2.1.4 - with: - go-version: ${{ matrix.go-version }} - - name: Checkout code - uses: actions/checkout@v2 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash - - name: Module cache - uses: actions/cache@v2.1.6 - env: - cache-name: go-mod-cache - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} - - name: Run tests - env: - GOARCH: ${{ matrix.arch }} - run: make test-short + - name: Install Go + uses: actions/setup-go@v2.1.4 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + shell: bash + - name: Module cache + uses: actions/cache@v2.1.6 + env: + cache-name: go-mod-cache + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + - name: Run tests + env: + GOARCH: ${{ matrix.arch }} + run: make test-short From 129240fdbf8e01304fbdb7169bec1c9d0cda7e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sun, 26 Sep 2021 00:35:19 +0200 Subject: [PATCH 03/10] fix: set right target on CI. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c36bb1f944..5de2e3bd0c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: path: ~/.tools key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} - name: Run linters - run: make dependabot-check license-check lint check-vanity-import + run: make dependabot-check license-check lint vanity-import-check - name: Build run: make examples build - name: Check clean repository From 42c8f06368a5198a36d9b13e8d321ab423b5677d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sun, 26 Sep 2021 00:52:26 +0200 Subject: [PATCH 04/10] fix: fixes install for porto. --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 656b3469c44..8836259e9c7 100644 --- a/Makefile +++ b/Makefile @@ -50,18 +50,21 @@ GOLANGCI_LINT = $(TOOLS)/golangci-lint $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint MISSPELL = $(TOOLS)/misspell -$(TOOLS)/misspell: PACKAGE= github.com/client9/misspell/cmd/misspell +$(TOOLS)/misspell: PACKAGE=github.com/client9/misspell/cmd/misspell GOCOVMERGE = $(TOOLS)/gocovmerge -$(TOOLS)/gocovmerge: PACKAGE= github.com/wadey/gocovmerge +$(TOOLS)/gocovmerge: PACKAGE=github.com/wadey/gocovmerge STRINGER = $(TOOLS)/stringer $(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer +PORTO = $(TOOLS)/porto +$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto + $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools -tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN) +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN) $(PORTO) # Build @@ -137,8 +140,8 @@ lint: misspell lint-modules | $(GOLANGCI_LINT) done .PHONY: vanity-import-check -vanity-import-check: - porto -l . +vanity-import-check: | $(MISSPELL) + $(PORTO) -l . .PHONY: misspell misspell: | $(MISSPELL) From cab5abf5aaecc63ecb6ec6d24f4fbeacaf17d427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sun, 26 Sep 2021 01:06:28 +0200 Subject: [PATCH 05/10] fix: install right proto bin. --- Makefile | 2 +- internal/tools/go.sum | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8836259e9c7..f0365093135 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ $(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools -tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN) $(PORTO) +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(TOOLS)/gojq $(SEMCONVGEN) # Build diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 683fe0d7202..e88120ef964 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -373,6 +373,7 @@ github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/itchyny/go-flags v1.5.0 h1:Z5q2ist2sfDjDlExVPBrMqlsEDxDR2h4zuOElB0OEYI= github.com/itchyny/go-flags v1.5.0/go.mod h1:lenkYuCobuxLBAd/HGFE4LRoW8D3B6iXRQfWYJ+MNbA= github.com/itchyny/gojq v0.12.5 h1:6SJ1BQ1VAwJAlIvLSIZmqHP/RUEq3qfVWvsRxrqhsD0= github.com/itchyny/gojq v0.12.5/go.mod h1:3e1hZXv+Kwvdp6V9HXpVrvddiHVApi5EDZwS+zLFeiE= From bdc94f257c695cf47d3633534bb90fbd20aaa3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Mon, 27 Sep 2021 10:14:14 +0200 Subject: [PATCH 06/10] chore: list all files insides the tools directory. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f0365093135..a5332c44059 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(TOOLS)/gojq $(SEMCONVGEN) - + @ls -la $(TOOLS) # Build From 8f0b36eebc5c88a9ba3d834f8ae7cdc685c86cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Mon, 27 Sep 2021 19:44:55 +0200 Subject: [PATCH 07/10] fix: fixes vanity import target Co-authored-by: Tyler Yahn --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a5332c44059..c8f5dc86601 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ lint: misspell lint-modules | $(GOLANGCI_LINT) done .PHONY: vanity-import-check -vanity-import-check: | $(MISSPELL) +vanity-import-check: | $(PORTO) $(PORTO) -l . .PHONY: misspell From b5d55beb17026d6906a57e2045cc881a0002ee4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Mon, 27 Sep 2021 19:52:06 +0200 Subject: [PATCH 08/10] chore(vanity-imports): adds vanity import support. --- exporters/otlp/otlpmetric/exporter.go | 2 +- exporters/otlp/otlpmetric/options.go | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/options.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/options.go | 2 +- exporters/otlp/otlptrace/otlptracehttp/client.go | 2 +- exporters/otlp/otlptrace/otlptracehttp/options.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 548a4afa381..6ce42e3b3f5 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric +package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import ( "context" diff --git a/exporters/otlp/otlpmetric/options.go b/exporters/otlp/otlpmetric/options.go index 500e7f22368..54ce1d0df79 100644 --- a/exporters/otlp/otlpmetric/options.go +++ b/exporters/otlp/otlpmetric/options.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric +package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import metricsdk "go.opentelemetry.io/otel/sdk/export/metric" diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go index 57b1a2ec08b..9a551217308 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetricgrpc +package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" import ( "fmt" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index ce933c5651e..b335e4ba2fc 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetrichttp +package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" import ( "bytes" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go index 645e9166760..ccb59415a3c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetrichttp +package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" import ( "crypto/tls" diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 4aa8782b38a..c3aa3c9ab39 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlptracehttp +package otlptracehttp // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" import ( "bytes" diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index 46cc6a5e41d..7cb45010e1a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlptracehttp +package otlptracehttp // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" import ( "crypto/tls" From 746b64e3cc6d82ac2fc33ae3267ac3151550d0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Mon, 27 Sep 2021 22:00:07 +0200 Subject: [PATCH 09/10] fix: fixes internal generation. --- Makefile | 4 ++-- internal/tools/go.mod | 3 ++- internal/tools/go.sum | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c8f5dc86601..6b68c844489 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,6 @@ $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(TOOLS)/gojq $(SEMCONVGEN) - @ls -la $(TOOLS) # Build @@ -81,7 +80,8 @@ generate: $(STRINGER) set -e; for dir in $(ALL_GO_MOD_DIRS); do \ echo "$(GO) generate $${dir}/..."; \ (cd "$${dir}" && \ - PATH="$(TOOLS):$${PATH}" $(GO) generate ./...); \ + PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && \ + $(PORTO) -w .); \ done build: generate diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 95d90c95e21..57bc409f55b 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -7,9 +7,10 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.42.1 github.com/itchyny/gojq v0.12.5 - github.com/jcchavezs/porto v0.2.0 + github.com/jcchavezs/porto v0.2.1 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210730171444-520d53fe242d + golang.org/x/mod v0.5.1 // indirect golang.org/x/tools v0.1.5 ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index e88120ef964..001632f2cc8 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -381,6 +381,8 @@ github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921i github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= github.com/jcchavezs/porto v0.2.0 h1:B+ghuY0E2cRQpMp+y7/cBEVVlkA7/5DvhMAGdvcqzW0= github.com/jcchavezs/porto v0.2.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= +github.com/jcchavezs/porto v0.2.1 h1:Ox0DkFvM3itXUVRQNV9DJnwdSzWe11NbyBqQhp4n37s= +github.com/jcchavezs/porto v0.2.1/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= @@ -795,6 +797,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= From faa1bfb943d63d688cdd46d0cc47412eb7fd3806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Mon, 27 Sep 2021 22:13:09 +0200 Subject: [PATCH 10/10] chore: runs go mod tidy in tools. --- internal/tools/go.sum | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 001632f2cc8..4f8db79be26 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -373,14 +373,11 @@ github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/itchyny/go-flags v1.5.0 h1:Z5q2ist2sfDjDlExVPBrMqlsEDxDR2h4zuOElB0OEYI= github.com/itchyny/go-flags v1.5.0/go.mod h1:lenkYuCobuxLBAd/HGFE4LRoW8D3B6iXRQfWYJ+MNbA= github.com/itchyny/gojq v0.12.5 h1:6SJ1BQ1VAwJAlIvLSIZmqHP/RUEq3qfVWvsRxrqhsD0= github.com/itchyny/gojq v0.12.5/go.mod h1:3e1hZXv+Kwvdp6V9HXpVrvddiHVApi5EDZwS+zLFeiE= github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= -github.com/jcchavezs/porto v0.2.0 h1:B+ghuY0E2cRQpMp+y7/cBEVVlkA7/5DvhMAGdvcqzW0= -github.com/jcchavezs/porto v0.2.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jcchavezs/porto v0.2.1 h1:Ox0DkFvM3itXUVRQNV9DJnwdSzWe11NbyBqQhp4n37s= github.com/jcchavezs/porto v0.2.1/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= @@ -795,7 +792,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=