[chore] prevent unkeyed literal initialization (#12762)
This relates to https://github.com/open-telemetry/opentelemetry-collector/issues/12360 Co-authored-by: Andrzej Stencel <andrzej.stencel@elastic.co>
This commit is contained in:
		
							parent
							
								
									cf18559059
								
							
						
					
					
						commit
						b3e68c3756
					
				| 
						 | 
				
			
			@ -101,6 +101,9 @@ type Info struct {
 | 
			
		|||
 | 
			
		||||
	// Metadata is the request metadata from the client connecting to this connector.
 | 
			
		||||
	Metadata Metadata
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AuthData represents the authentication data as seen by authenticators tied to
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,8 @@ var (
 | 
			
		|||
type Authentication struct {
 | 
			
		||||
	// AuthenticatorID specifies the name of the extension to use in order to authenticate the incoming data point.
 | 
			
		||||
	AuthenticatorID component.ID `mapstructure:"authenticator,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetServerAuthenticator attempts to select the appropriate extensionauth.Server from the list of extensions,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,8 @@ type Level int
 | 
			
		|||
 | 
			
		||||
type CompressionParams struct {
 | 
			
		||||
	Level Level `mapstructure:"level"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +68,7 @@ func (ct *Type) ValidateParams(p CompressionParams) error {
 | 
			
		|||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
	if p.Level != 0 {
 | 
			
		||||
		return fmt.Errorf("unsupported parameters %+v for compression type %q", p, *ct)
 | 
			
		||||
		return fmt.Errorf("unsupported parameters {Level:%+v} for compression type %q", p.Level, *ct)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,6 +46,8 @@ type KeepaliveClientConfig struct {
 | 
			
		|||
	Time                time.Duration `mapstructure:"time"`
 | 
			
		||||
	Timeout             time.Duration `mapstructure:"timeout"`
 | 
			
		||||
	PermitWithoutStream bool          `mapstructure:"permit_without_stream,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultKeepaliveClientConfig returns a new instance of KeepaliveClientConfig with default values.
 | 
			
		||||
| 
						 | 
				
			
			@ -118,6 +120,8 @@ func NewDefaultClientConfig() *ClientConfig {
 | 
			
		|||
type KeepaliveServerConfig struct {
 | 
			
		||||
	ServerParameters  *KeepaliveServerParameters  `mapstructure:"server_parameters,omitempty"`
 | 
			
		||||
	EnforcementPolicy *KeepaliveEnforcementPolicy `mapstructure:"enforcement_policy,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultKeepaliveServerConfig returns a new instance of KeepaliveServerConfig with default values.
 | 
			
		||||
| 
						 | 
				
			
			@ -137,6 +141,8 @@ type KeepaliveServerParameters struct {
 | 
			
		|||
	MaxConnectionAgeGrace time.Duration `mapstructure:"max_connection_age_grace,omitempty"`
 | 
			
		||||
	Time                  time.Duration `mapstructure:"time,omitempty"`
 | 
			
		||||
	Timeout               time.Duration `mapstructure:"timeout,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultKeepaliveServerParameters creates and returns a new instance of KeepaliveServerParameters with default settings.
 | 
			
		||||
| 
						 | 
				
			
			@ -150,6 +156,8 @@ func NewDefaultKeepaliveServerParameters() *KeepaliveServerParameters {
 | 
			
		|||
type KeepaliveEnforcementPolicy struct {
 | 
			
		||||
	MinTime             time.Duration `mapstructure:"min_time,omitempty"`
 | 
			
		||||
	PermitWithoutStream bool          `mapstructure:"permit_without_stream,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultKeepaliveEnforcementPolicy creates and returns a new instance of KeepaliveEnforcementPolicy with default settings.
 | 
			
		||||
| 
						 | 
				
			
			@ -189,6 +197,8 @@ type ServerConfig struct {
 | 
			
		|||
 | 
			
		||||
	// Include propagates the incoming connection's metadata to downstream consumers.
 | 
			
		||||
	IncludeMetadata bool `mapstructure:"include_metadata,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultServerConfig returns a new instance of ServerConfig with default values.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -117,6 +117,7 @@ type ClientConfig struct {
 | 
			
		|||
type CookiesConfig struct {
 | 
			
		||||
	// Enabled if true, cookies from HTTP responses will be reused in further HTTP requests with the same server.
 | 
			
		||||
	Enabled bool `mapstructure:"enabled,omitempty"`
 | 
			
		||||
	_       struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultClientConfig returns ClientConfig type object with
 | 
			
		||||
| 
						 | 
				
			
			@ -361,6 +362,8 @@ type AuthConfig struct {
 | 
			
		|||
	// RequestParameters is a list of parameters that should be extracted from the request and added to the context.
 | 
			
		||||
	// When a parameter is found in both the query string and the header, the value from the query string will be used.
 | 
			
		||||
	RequestParameters []string `mapstructure:"request_params,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ToListener creates a net.Listener.
 | 
			
		||||
| 
						 | 
				
			
			@ -530,6 +533,8 @@ type CORSConfig struct {
 | 
			
		|||
	// Set it to the number of seconds that browsers should cache a CORS
 | 
			
		||||
	// preflight response for.
 | 
			
		||||
	MaxAge int `mapstructure:"max_age,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultCORSConfig creates a default cross-origin resource sharing (CORS) configuration.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,6 +60,8 @@ type DialerConfig struct {
 | 
			
		|||
	// Timeout is the maximum amount of time a dial will wait for
 | 
			
		||||
	// a connect to complete. The default is no timeout.
 | 
			
		||||
	Timeout time.Duration `mapstructure:"timeout,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultDialerConfig creates a new DialerConfig with any default values set
 | 
			
		||||
| 
						 | 
				
			
			@ -82,6 +84,8 @@ type AddrConfig struct {
 | 
			
		|||
 | 
			
		||||
	// DialerConfig contains options for connecting to an address.
 | 
			
		||||
	DialerConfig DialerConfig `mapstructure:"dialer,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultAddrConfig creates a new AddrConfig with any default values set
 | 
			
		||||
| 
						 | 
				
			
			@ -134,6 +138,8 @@ type TCPAddrConfig struct {
 | 
			
		|||
 | 
			
		||||
	// DialerConfig contains options for connecting to an address.
 | 
			
		||||
	DialerConfig DialerConfig `mapstructure:"dialer,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultTCPAddrConfig creates a new TCPAddrConfig with any default values set
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,8 @@ type BackOffConfig struct {
 | 
			
		|||
	// MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch.
 | 
			
		||||
	// Once this value is reached, the data is discarded. If set to 0, the retries are never stopped.
 | 
			
		||||
	MaxElapsedTime time.Duration `mapstructure:"max_elapsed_time"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (bs *BackOffConfig) Validate() error {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,6 +102,8 @@ type ClientConfig struct {
 | 
			
		|||
	// This sets the ServerName in the TLSConfig. Please refer to
 | 
			
		||||
	// https://godoc.org/crypto/tls#Config for more information. (optional)
 | 
			
		||||
	ServerName string `mapstructure:"server_name_override,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultClientConfig creates a new TLSClientSetting with any default values set.
 | 
			
		||||
| 
						 | 
				
			
			@ -128,6 +130,8 @@ type ServerConfig struct {
 | 
			
		|||
	// Reload the ClientCAs file when it is modified
 | 
			
		||||
	// (optional, default false)
 | 
			
		||||
	ReloadClientCAFile bool `mapstructure:"client_ca_file_reload,omitempty"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultServerConfig creates a new TLSServerSetting with any default values set.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,9 @@ type ConverterSettings struct {
 | 
			
		|||
	// when instantiating a Converter with a ConverterFactory,
 | 
			
		||||
	// nil Logger references should be replaced with a no-op Logger.
 | 
			
		||||
	Logger *zap.Logger
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ConverterFactory defines a factory that can be used to instantiate
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,9 @@ type ProviderSettings struct {
 | 
			
		|||
	// when instantiating a Provider with a ProviderFactory,
 | 
			
		||||
	// nil Logger references should be replaced with a no-op Logger.
 | 
			
		||||
	Logger *zap.Logger
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProviderFactory defines a factory that can be used to instantiate
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,6 +65,9 @@ type ResolverSettings struct {
 | 
			
		|||
	// ConverterSettings contains settings that will be passed to Converter
 | 
			
		||||
	// factories when instantiating Converters.
 | 
			
		||||
	ConverterSettings ConverterSettings
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewResolver returns a new Resolver that resolves configuration from multiple URIs.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,6 +69,8 @@ type Settings struct {
 | 
			
		|||
 | 
			
		||||
	// BuildInfo can be used by components for informational purposes
 | 
			
		||||
	BuildInfo component.BuildInfo
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Factory is a factory interface for connectors.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,9 @@ type Config struct {
 | 
			
		|||
 | 
			
		||||
	// UseInternalLogger defines whether the exporter sends the output to the collector's internal logger.
 | 
			
		||||
	UseInternalLogger bool `mapstructure:"use_internal_logger"`
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ component.Config = (*Config)(nil)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,9 @@ type Settings struct {
 | 
			
		|||
 | 
			
		||||
	// BuildInfo can be used by components for informational purposes
 | 
			
		||||
	BuildInfo component.BuildInfo
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Factory is factory interface for exporters.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,9 @@ type Settings struct {
 | 
			
		|||
 | 
			
		||||
	// BuildInfo can be used by components for informational purposes
 | 
			
		||||
	BuildInfo component.BuildInfo
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateFunc is the equivalent of Factory.Create(...) function.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,8 @@ type Config struct {
 | 
			
		|||
	confighttp.ServerConfig `mapstructure:",squash"`
 | 
			
		||||
 | 
			
		||||
	Expvar ExpvarConfig `mapstructure:"expvar"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExpvarConfig has the configuration for the expvar service.
 | 
			
		||||
| 
						 | 
				
			
			@ -22,6 +24,8 @@ type ExpvarConfig struct {
 | 
			
		|||
	// Enabled indicates whether to enable expvar service.
 | 
			
		||||
	// (default = false)
 | 
			
		||||
	Enabled bool `mapstructure:"enabled"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ component.Config = (*Config)(nil)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,8 @@ import (
 | 
			
		|||
type Config struct {
 | 
			
		||||
	Strict string `mapstructure:"strict"`
 | 
			
		||||
	Regex  string `mapstructure:"regexp"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Config) Validate() error {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,6 +44,8 @@ type Config struct {
 | 
			
		|||
	// batcher instances that will be created through a distinct
 | 
			
		||||
	// combination of MetadataKeys.
 | 
			
		||||
	MetadataCardinalityLimit uint32 `mapstructure:"metadata_cardinality_limit"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ component.Config = (*Config)(nil)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,9 @@ type Settings struct {
 | 
			
		|||
 | 
			
		||||
	// BuildInfo can be used by components for informational purposes
 | 
			
		||||
	BuildInfo component.BuildInfo
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Factory is Factory interface for processors.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,12 +32,17 @@ type HTTPConfig struct {
 | 
			
		|||
 | 
			
		||||
	// The URL path to receive logs on. If omitted "/v1/logs" will be used.
 | 
			
		||||
	LogsURLPath string `mapstructure:"logs_url_path,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Protocols is the configuration for the supported protocols.
 | 
			
		||||
type Protocols struct {
 | 
			
		||||
	GRPC *configgrpc.ServerConfig `mapstructure:"grpc"`
 | 
			
		||||
	HTTP *HTTPConfig              `mapstructure:"http"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Config defines configuration for OTLP receiver.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,6 +48,9 @@ type Settings struct {
 | 
			
		|||
 | 
			
		||||
	// BuildInfo can be used by components for informational purposes.
 | 
			
		||||
	BuildInfo component.BuildInfo
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Factory is a factory interface for receivers.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,6 +42,9 @@ type ObsReportSettings struct {
 | 
			
		|||
	// operations without a corresponding new context per operation.
 | 
			
		||||
	LongLivedCtx           bool
 | 
			
		||||
	ReceiverCreateSettings receiver.Settings
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewObsReport creates a new ObsReport.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,9 @@ type Settings struct {
 | 
			
		|||
 | 
			
		||||
	// BuildInfo can be used by components for informational purposes.
 | 
			
		||||
	BuildInfo component.BuildInfo
 | 
			
		||||
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Factory is factory interface for scrapers.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,8 @@ type ControllerConfig struct {
 | 
			
		|||
	InitialDelay time.Duration `mapstructure:"initial_delay"`
 | 
			
		||||
	// Timeout is an optional value used to set scraper's context deadline.
 | 
			
		||||
	Timeout time.Duration `mapstructure:"timeout"`
 | 
			
		||||
	// prevent unkeyed literal initialization
 | 
			
		||||
	_ struct{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewDefaultControllerConfig returns default scraper controller
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue