Adds vanity import check (#4180)

* chore: adds porto and fixes vanity imports.

* chore: fixes target overriding.

* chore: fixes install of porto.

* chore: includes porto as a tool.

* chore: upgrades porto to check internals.

* chore: rebase and update vanity import.

* chore: removes unnecessary space.

* chore: rollsback vanity import in generated files.
This commit is contained in:
José Carlos Chávez 2021-10-12 22:47:36 +02:00 committed by GitHub
parent 6654804518
commit 9d3a8a4608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
267 changed files with 283 additions and 267 deletions

View File

@ -1,9 +1,9 @@
name: build-and-test
on:
push:
branches: [ main ]
branches: [main]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
jobs:
@ -77,7 +77,7 @@ jobs:
path: /home/runner/go/bin
key: tools-${{ runner.os }}-${{ hashFiles('./internal/tools/go.mod', './cmd/mdatagen/go.mod', './cmd/mdatagen/*.go') }}
- name: Lint
run: make -j5 checklicense misspell checkdoc goimpi golint
run: make -j5 checklicense misspell checkdoc goimpi golint goporto
- name: Gen Metadata
run: |
make genmdata
@ -206,4 +206,3 @@ jobs:
with:
name: collector-binaries-unstable
path: ./bin-unstable.tar

View File

@ -71,6 +71,10 @@ gotest-with-cover:
@$(MAKE) for-all CMD="make test-with-cover"
$(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt
.PHONY: goporto
goporto:
@$(MAKE) for-all CMD="make porto"
.PHONY: golint
golint:
@$(MAKE) for-all CMD="make lint lint-unstable"
@ -134,6 +138,7 @@ install-tools:
cd $(TOOLS_MOD_DIR) && go install go.opentelemetry.io/build-tools/semconvgen
cd $(TOOLS_MOD_DIR) && go install golang.org/x/exp/cmd/apidiff
cd $(TOOLS_MOD_DIR) && go install golang.org/x/tools/cmd/goimports
cd $(TOOLS_MOD_DIR) && go install github.com/jcchavezs/porto/cmd/porto
.PHONY: otelcol
otelcol:

View File

@ -38,6 +38,10 @@ lint:
lint-unstable:
$(LINT) run --allow-parallel-runners --build-tags enable_unstable
.PHONY: porto
porto:
porto -w --include-internal ./
.PHONY: impi
impi:
@$(IMPI) --local go.opentelemetry.io/collector --scheme stdThirdPartyLocal ./...

View File

@ -13,7 +13,7 @@
// limitations under the License.
// Package client contains generic representations of clients connecting to different receivers
package client
package client // import "go.opentelemetry.io/collector/client"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
import (
"os"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
import (
"os"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
import (
"os"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
var commonFile = &File{
Name: "common",

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
import "strings"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
var logFile = &File{
Name: "log",

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
var metricsFile = &File{
Name: "metrics",

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
var resourceFile = &File{
Name: "resource",

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/cmd/pdatagen/internal"
var traceFile = &File{
Name: "trace",

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
// BuildInfo is the information that is logged at the application start and
// passed into each component. This information can be overridden in custom builds.

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"context"

View File

@ -14,4 +14,4 @@
// Package componenterror provides helper functions to create and process
// OpenTelemetry component errors.
package componenterror
package componenterror // import "go.opentelemetry.io/collector/component/componenterror"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenterror
package componenterror // import "go.opentelemetry.io/collector/component/componenterror"
import (
"errors"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenthelper
package componenthelper // import "go.opentelemetry.io/collector/component/componenthelper"
import (
"context"

View File

@ -13,4 +13,4 @@
// limitations under the License.
// Package componenthelper assists with the creation of a new component.Component.
package componenthelper
package componenthelper // import "go.opentelemetry.io/collector/component/componenthelper"

View File

@ -14,4 +14,4 @@
// Package componenttest define types and functions used to help test packages
// implementing the component package interfaces.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"go.opentelemetry.io/collector/component"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"go.opentelemetry.io/collector/component"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"go.opentelemetry.io/otel/metric"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package componenttest
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
import (
"context"

View File

@ -16,4 +16,4 @@
// and provides a foundation for the components creation and
// termination process. A component can be either a receiver, exporter,
// processor, or an extension.
package component
package component // import "go.opentelemetry.io/collector/component"

View File

@ -16,4 +16,4 @@
// that typically live under the "go.opentelemetry.io/collector/component"
// package but aren't stable yet to be published there.
// ATTENTION: the package is still experimental and subject to changes without advanced notice.
package component
package component // import "go.opentelemetry.io/collector/component/experimental/component"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component/experimental/component"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"fmt"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"go.opentelemetry.io/collector/config"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package component
package component // import "go.opentelemetry.io/collector/component"
import (
"go.opentelemetry.io/otel/metric"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
import (
"errors"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configauth
package configauth // import "go.opentelemetry.io/collector/config/configauth"
import (
"fmt"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configauth
package configauth // import "go.opentelemetry.io/collector/config/configauth"
import (
"errors"

View File

@ -15,4 +15,4 @@
// Package configauth implements the configuration settings to
// ensure authentication on incoming requests, and allows
// exporters to add authentication on outgoing requests.
package configauth
package configauth // import "go.opentelemetry.io/collector/config/configauth"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configauth
package configauth // import "go.opentelemetry.io/collector/config/configauth"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configauth
package configauth // import "go.opentelemetry.io/collector/config/configauth"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configauth
package configauth // import "go.opentelemetry.io/collector/config/configauth"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configgrpc
package configgrpc // import "go.opentelemetry.io/collector/config/configgrpc"
import (
"crypto/tls"

View File

@ -14,4 +14,4 @@
// Package configgrpc defines the configuration settings to create
// a gRPC client and server.
package configgrpc
package configgrpc // import "go.opentelemetry.io/collector/config/configgrpc"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configgrpc
package configgrpc // import "go.opentelemetry.io/collector/config/configgrpc"
import (
// Import the gzip package which auto-registers the gzip gRPC compressor.

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package confighttp
package confighttp // import "go.opentelemetry.io/collector/config/confighttp"
import (
"crypto/tls"

View File

@ -14,4 +14,4 @@
// Package confighttp defines the configuration settings
// for creating an HTTP client and server.
package confighttp
package confighttp // import "go.opentelemetry.io/collector/config/confighttp"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
import (
"fmt"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package confignet
package confignet // import "go.opentelemetry.io/collector/config/confignet"
import (
"net"

View File

@ -14,4 +14,4 @@
// Package confignet implements the configuration settings for protocols to
// connect and transport data information.
package confignet
package confignet // import "go.opentelemetry.io/collector/config/confignet"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configtelemetry
package configtelemetry // import "go.opentelemetry.io/collector/config/configtelemetry"
import (
"flag"

View File

@ -15,4 +15,4 @@
// Package configtelemetry defines various telemetry level for configuration.
// It enables every component to have access to telemetry level
// to enable metrics only when necessary.
package configtelemetry
package configtelemetry // import "go.opentelemetry.io/collector/config/configtelemetry"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configtest
package configtest // import "go.opentelemetry.io/collector/config/configtest"
import (
"context"

View File

@ -14,4 +14,4 @@
// Package configtest loads the configuration to test packages
// implementing the config package interfaces.
package configtest
package configtest // import "go.opentelemetry.io/collector/config/configtest"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configtls
package configtls // import "go.opentelemetry.io/collector/config/configtls"
import (
"crypto/tls"

View File

@ -14,4 +14,4 @@
// Package configtls implements the TLS settings to load and
// configure TLS clients and servers.
package configtls
package configtls // import "go.opentelemetry.io/collector/config/configtls"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configunmarshaler
package configunmarshaler // import "go.opentelemetry.io/collector/config/configunmarshaler"
import (
"fmt"

View File

@ -15,4 +15,4 @@
// Package configunmarshaler implements configuration unmarshalling from a config.Map.
// The implementation relies on registered factories that allow creating
// default configuration for each type of receiver/exporter/processor.
package configunmarshaler
package configunmarshaler // import "go.opentelemetry.io/collector/config/configunmarshaler"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configunmarshaler
package configunmarshaler // import "go.opentelemetry.io/collector/config/configunmarshaler"
import (
"go.opentelemetry.io/collector/component"

View File

@ -27,4 +27,4 @@
// Specific Receivers/Exporters/Processors are expected to at the minimum implement the
// corresponding interface and if they have additional settings they must also extend
// the corresponding common settings struct (the easiest approach is to embed the common struct).
package config
package config // import "go.opentelemetry.io/collector/config"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config/experimental/config"
import (
"go.opentelemetry.io/collector/config"

View File

@ -16,4 +16,4 @@
// that typically live under the "go.opentelemetry.io/collector/config" package but aren't stable yet
// to be published there.
// ATTENTION: the package is still experimental and subject to changes without advanced notice.
package config
package config // import "go.opentelemetry.io/collector/config/experimental/config"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configsource
package configsource // import "go.opentelemetry.io/collector/config/experimental/configsource"
import (
"context"

View File

@ -17,4 +17,4 @@
// sources retrieve values from their respective storages. A configuration parser/loader
// can inject these values in the configuration data used by the collector.
// ATTENTION: the package is still experimental and subject to changes without advanced notice.
package configsource
package configsource // import "go.opentelemetry.io/collector/config/experimental/configsource"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
// Exporter is the configuration of a component.Exporter. Specific extensions must implement
// this interface and must embed ExporterSettings struct or a struct that extends it.

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
// Extension is the configuration of a component.Extension. Specific extensions must implement
// this interface and must embed ExtensionSettings struct or a struct that extends it.

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
import (
"errors"

View File

@ -15,4 +15,4 @@
// Package configsource is an internal package that implements methods
// for injecting, watching, and updating data from ConfigSource into
// configuration.
package configsource
package configsource // import "go.opentelemetry.io/collector/config/internal/configsource"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package configsource
package configsource // import "go.opentelemetry.io/collector/config/internal/configsource"
import (
"bytes"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
// Processor is the configuration of a component.Processor. Specific extensions must implement
// this interface and must embed ProcessorSettings struct or a struct that extends it.

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package config
package config // import "go.opentelemetry.io/collector/config"
// Receiver is the configuration of a component.Receiver. Specific extensions must implement
// this interface and must embed ReceiverSettings struct or a struct that extends it.

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumer
package consumer // import "go.opentelemetry.io/collector/consumer"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumererror
package consumererror // import "go.opentelemetry.io/collector/consumer/consumererror"
import (
"errors"

View File

@ -15,4 +15,4 @@
// Package consumererror provides wrappers to easily classify errors. This allows
// appropriate action by error handlers without the need to know each individual
// error type/instance.
package consumererror
package consumererror // import "go.opentelemetry.io/collector/consumer/consumererror"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumererror
package consumererror // import "go.opentelemetry.io/collector/consumer/consumererror"
import "errors"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumererror
package consumererror // import "go.opentelemetry.io/collector/consumer/consumererror"
import (
"errors"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumerhelper
package consumerhelper // import "go.opentelemetry.io/collector/consumer/consumerhelper"
import (
"errors"

View File

@ -14,4 +14,4 @@
// Package consumerhelper defines types and functions used to create consumer
// Logs, Metrics, and Traces.
package consumerhelper
package consumerhelper // import "go.opentelemetry.io/collector/consumer/consumerhelper"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumerhelper
package consumerhelper // import "go.opentelemetry.io/collector/consumer/consumerhelper"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumerhelper
package consumerhelper // import "go.opentelemetry.io/collector/consumer/consumerhelper"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumerhelper
package consumerhelper // import "go.opentelemetry.io/collector/consumer/consumerhelper"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumertest
package consumertest // import "go.opentelemetry.io/collector/consumer/consumertest"
import (
"go.opentelemetry.io/collector/consumer"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumertest
package consumertest // import "go.opentelemetry.io/collector/consumer/consumertest"
import (
"context"

View File

@ -14,4 +14,4 @@
// Package consumertest defines types and functions used to help test packages
// implementing the consumer package interfaces.
package consumertest
package consumertest // import "go.opentelemetry.io/collector/consumer/consumertest"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumertest
package consumertest // import "go.opentelemetry.io/collector/consumer/consumertest"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumertest
package consumertest // import "go.opentelemetry.io/collector/consumer/consumertest"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package consumertest
package consumertest // import "go.opentelemetry.io/collector/consumer/consumertest"
import (
"context"

View File

@ -13,4 +13,4 @@
// limitations under the License.
// Package consumer contains interfaces that receive and process consumerdata.
package consumer
package consumer // import "go.opentelemetry.io/collector/consumer"

View File

@ -19,4 +19,4 @@
//
// To make the custom exporter part of the Collector build the factory must be added
// to defaultcomponents.Components() function.
package exporter
package exporter // import "go.opentelemetry.io/collector/exporter"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package exporterhelper
package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package exporterhelper
package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper"
import (
"errors"

View File

@ -13,4 +13,4 @@
// limitations under the License.
// Package exporterhelper provides helper functions for exporters.
package exporterhelper
package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package exporterhelper
package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper"
import (
"context"

View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/exporter/exporterhelper/internal"
import (
"sync"

View File

@ -15,7 +15,7 @@
//go:build enable_unstable
// +build enable_unstable
package internal
package internal // import "go.opentelemetry.io/collector/exporter/exporterhelper/internal"
import (
"context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package internal // import "go.opentelemetry.io/collector/exporter/exporterhelper/internal"
// PersistentRequest defines capabilities required for persistent storage of a request
type PersistentRequest interface {

View File

@ -15,7 +15,7 @@
//go:build enable_unstable
// +build enable_unstable
package internal
package internal // import "go.opentelemetry.io/collector/exporter/exporterhelper/internal"
import (
"context"

Some files were not shown because too many files have changed in this diff Show More