From a44516d3378d138818a169bc7cff576dd42cf1f9 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Wed, 7 Feb 2024 04:00:05 +0000 Subject: [PATCH 1/5] fix golangcilint config for updated version --- .golangci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 1c34cc9202..13626a173c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,7 +14,7 @@ # limitations under the License. # run: - deadline: 30m + timeout: 30m skip-dirs: - (^|/)apis($|/) - (^|/)hack/benchmark($|/) @@ -122,6 +122,7 @@ linters: # - whitespace # - wrapcheck # - wslissues: +issues: exclude-use-default: false exclude-rules: - path: _test\.go From 22eea3c01b276fcb0cee221d7b8b0255671b9935 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Wed, 7 Feb 2024 04:00:15 +0000 Subject: [PATCH 2/5] Apply tagalign --- internal/config/blob.go | 46 +++++++++--------- internal/config/circuitbreaker.go | 10 ++-- internal/config/faiss.go | 34 ++++++------- internal/config/index.go | 12 ++--- internal/config/net.go | 22 ++++----- internal/config/ngt.go | 48 +++++++++---------- internal/config/server.go | 2 +- internal/config/sidecar.go | 26 +++++----- internal/config/tls.go | 10 ++-- internal/config/transport.go | 26 +++++----- .../k8s/vald/benchmark/api/v1/job_types.go | 2 +- pkg/tools/cli/loadtest/config/config.go | 2 +- 12 files changed, 120 insertions(+), 120 deletions(-) diff --git a/internal/config/blob.go b/internal/config/blob.go index 6a25cd1380..072555c0b5 100644 --- a/internal/config/blob.go +++ b/internal/config/blob.go @@ -67,45 +67,45 @@ type Blob struct { // S3Config represents S3Config configuration. type S3Config struct { - Endpoint string `json:"endpoint" yaml:"endpoint"` - Region string `json:"region" yaml:"region"` - AccessKey string `json:"access_key" yaml:"access_key"` + Endpoint string `json:"endpoint" yaml:"endpoint"` + Region string `json:"region" yaml:"region"` + AccessKey string `json:"access_key" yaml:"access_key"` SecretAccessKey string `json:"secret_access_key" yaml:"secret_access_key"` - Token string `json:"token" yaml:"token"` - - MaxRetries int `json:"max_retries" yaml:"max_retries"` - ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style"` - UseAccelerate bool `json:"use_accelerate" yaml:"use_accelerate"` - UseARNRegion bool `json:"use_arn_region" yaml:"use_arn_region"` - UseDualStack bool `json:"use_dual_stack" yaml:"use_dual_stack"` - EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl"` - EnableParamValidation bool `json:"enable_param_validation" yaml:"enable_param_validation"` - Enable100Continue bool `json:"enable_100_continue" yaml:"enable_100_continue"` + Token string `json:"token" yaml:"token"` + + MaxRetries int `json:"max_retries" yaml:"max_retries"` + ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style"` + UseAccelerate bool `json:"use_accelerate" yaml:"use_accelerate"` + UseARNRegion bool `json:"use_arn_region" yaml:"use_arn_region"` + UseDualStack bool `json:"use_dual_stack" yaml:"use_dual_stack"` + EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl"` + EnableParamValidation bool `json:"enable_param_validation" yaml:"enable_param_validation"` + Enable100Continue bool `json:"enable_100_continue" yaml:"enable_100_continue"` EnableContentMD5Validation bool `json:"enable_content_md5_validation" yaml:"enable_content_md5_validation"` - EnableEndpointDiscovery bool `json:"enable_endpoint_discovery" yaml:"enable_endpoint_discovery"` - EnableEndpointHostPrefix bool `json:"enable_endpoint_host_prefix" yaml:"enable_endpoint_host_prefix"` + EnableEndpointDiscovery bool `json:"enable_endpoint_discovery" yaml:"enable_endpoint_discovery"` + EnableEndpointHostPrefix bool `json:"enable_endpoint_host_prefix" yaml:"enable_endpoint_host_prefix"` - MaxPartSize string `json:"max_part_size" yaml:"max_part_size"` + MaxPartSize string `json:"max_part_size" yaml:"max_part_size"` MaxChunkSize string `json:"max_chunk_size" yaml:"max_chunk_size"` } // CloudStorageConfig represents CloudStorage configuration. type CloudStorageConfig struct { - URL string `json:"url" yaml:"url"` + URL string `json:"url" yaml:"url"` Client *CloudStorageClient `json:"client" yaml:"client"` - WriteBufferSize int `json:"write_buffer_size" yaml:"write_buffer_size"` - WriteCacheControl string `json:"write_cache_control" yaml:"write_cache_control"` + WriteBufferSize int `json:"write_buffer_size" yaml:"write_buffer_size"` + WriteCacheControl string `json:"write_cache_control" yaml:"write_cache_control"` WriteContentDisposition string `json:"write_content_disposition" yaml:"write_content_disposition"` - WriteContentEncoding string `json:"write_content_encoding" yaml:"write_content_encoding"` - WriteContentLanguage string `json:"write_content_language" yaml:"write_content_language"` - WriteContentType string `json:"write_content_type" yaml:"write_content_type"` + WriteContentEncoding string `json:"write_content_encoding" yaml:"write_content_encoding"` + WriteContentLanguage string `json:"write_content_language" yaml:"write_content_language"` + WriteContentType string `json:"write_content_type" yaml:"write_content_type"` } // CloudStorageClient represents CloudStorage client configuration. type CloudStorageClient struct { CredentialsFilePath string `json:"credentials_file_path" yaml:"credentials_file_path"` - CredentialsJSON string `json:"credentials_json" yaml:"credentials_json"` + CredentialsJSON string `json:"credentials_json" yaml:"credentials_json"` } // Bind binds the actual data from the Blob receiver field. diff --git a/internal/config/circuitbreaker.go b/internal/config/circuitbreaker.go index 7f545583f8..9af8adc18f 100644 --- a/internal/config/circuitbreaker.go +++ b/internal/config/circuitbreaker.go @@ -15,11 +15,11 @@ package config // CircuitBreaker represents the configuration for the internal circuitbreaker package. type CircuitBreaker struct { - ClosedErrorRate float32 `yaml:"closed_error_rate" json:"closed_error_rate,omitempty"` - HalfOpenErrorRate float32 `yaml:"half_open_error_rate" json:"half_open_error_rate,omitempty"` - MinSamples int64 `yaml:"min_samples" json:"min_samples,omitempty"` - OpenTimeout string `yaml:"open_timeout" json:"open_timeout,omitempty"` - ClosedRefreshTimeout string `yaml:"closed_refresh_timeout" json:"closed_refresh_timeout,omitempty"` + ClosedErrorRate float32 `json:"closed_error_rate,omitempty" yaml:"closed_error_rate"` + HalfOpenErrorRate float32 `json:"half_open_error_rate,omitempty" yaml:"half_open_error_rate"` + MinSamples int64 `json:"min_samples,omitempty" yaml:"min_samples"` + OpenTimeout string `json:"open_timeout,omitempty" yaml:"open_timeout"` + ClosedRefreshTimeout string `json:"closed_refresh_timeout,omitempty" yaml:"closed_refresh_timeout"` } func (cb *CircuitBreaker) Bind() *CircuitBreaker { diff --git a/internal/config/faiss.go b/internal/config/faiss.go index f6e97e6d46..df6f750743 100644 --- a/internal/config/faiss.go +++ b/internal/config/faiss.go @@ -20,58 +20,58 @@ package config // Faiss represent the faiss core configuration for server. type Faiss struct { // IndexPath represents the faiss index file path - IndexPath string `yaml:"index_path" json:"index_path,omitempty"` + IndexPath string `json:"index_path,omitempty" yaml:"index_path"` // Dimension represents the faiss index dimension - Dimension int `yaml:"dimension" json:"dimension,omitempty" info:"dimension"` + Dimension int `info:"dimension" json:"dimension,omitempty" yaml:"dimension"` // Nlist represents the number of Voronoi cells // ref: https://github.com/facebookresearch/faiss/wiki/Faster-search - Nlist int `yaml:"nlist" json:"nlist,omitempty" info:"nlist"` + Nlist int `info:"nlist" json:"nlist,omitempty" yaml:"nlist"` // M represents the number of subquantizers // ref: https://github.com/facebookresearch/faiss/wiki/Faiss-indexes-(composite)#cell-probe-method-with-a-pq-index-as-coarse-quantizer - M int `yaml:"m" json:"m,omitempty" info:"m"` + M int `info:"m" json:"m,omitempty" yaml:"m"` // NbitsPerIdx represents the number of bit per subvector index // ref: https://github.com/facebookresearch/faiss/wiki/FAQ#can-i-ignore-warning-clustering-xxx-points-to-yyy-centroids - NbitsPerIdx int `yaml:"nbits_per_idx" json:"nbits_per_idx,omitempty" info:"nbits_per_idx"` + NbitsPerIdx int `info:"nbits_per_idx" json:"nbits_per_idx,omitempty" yaml:"nbits_per_idx"` // MetricType represents the metric type - MetricType string `yaml:"metric_type" json:"metric_type,omitempty" info:"metric_type"` + MetricType string `info:"metric_type" json:"metric_type,omitempty" yaml:"metric_type"` // EnableInMemoryMode enables on memory faiss indexing mode - EnableInMemoryMode bool `yaml:"enable_in_memory_mode" json:"enable_in_memory_mode,omitempty"` + EnableInMemoryMode bool `json:"enable_in_memory_mode,omitempty" yaml:"enable_in_memory_mode"` // AutoIndexCheckDuration represents checking loop duration about auto indexing execution - AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration,omitempty"` + AutoIndexCheckDuration string `json:"auto_index_check_duration,omitempty" yaml:"auto_index_check_duration"` // AutoSaveIndexDuration represents checking loop duration about auto save index execution - AutoSaveIndexDuration string `yaml:"auto_save_index_duration" json:"auto_save_index_duration,omitempty"` + AutoSaveIndexDuration string `json:"auto_save_index_duration,omitempty" yaml:"auto_save_index_duration"` // AutoIndexDurationLimit represents auto indexing duration limit - AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit,omitempty"` + AutoIndexDurationLimit string `json:"auto_index_duration_limit,omitempty" yaml:"auto_index_duration_limit"` // AutoIndexLength represents auto index length limit - AutoIndexLength int `yaml:"auto_index_length" json:"auto_index_length,omitempty"` + AutoIndexLength int `json:"auto_index_length,omitempty" yaml:"auto_index_length"` // InitialDelayMaxDuration represents maximum duration for initial delay - InitialDelayMaxDuration string `yaml:"initial_delay_max_duration" json:"initial_delay_max_duration,omitempty"` + InitialDelayMaxDuration string `json:"initial_delay_max_duration,omitempty" yaml:"initial_delay_max_duration"` // MinLoadIndexTimeout represents minimum duration of load index timeout - MinLoadIndexTimeout string `yaml:"min_load_index_timeout" json:"min_load_index_timeout,omitempty"` + MinLoadIndexTimeout string `json:"min_load_index_timeout,omitempty" yaml:"min_load_index_timeout"` // MaxLoadIndexTimeout represents maximum duration of load index timeout - MaxLoadIndexTimeout string `yaml:"max_load_index_timeout" json:"max_load_index_timeout,omitempty"` + MaxLoadIndexTimeout string `json:"max_load_index_timeout,omitempty" yaml:"max_load_index_timeout"` // LoadIndexTimeoutFactor represents a factor of load index timeout - LoadIndexTimeoutFactor string `yaml:"load_index_timeout_factor" json:"load_index_timeout_factor,omitempty"` + LoadIndexTimeoutFactor string `json:"load_index_timeout_factor,omitempty" yaml:"load_index_timeout_factor"` // EnableProactiveGC enables more proactive GC call for reducing heap memory allocation - EnableProactiveGC bool `yaml:"enable_proactive_gc" json:"enable_proactive_gc,omitempty"` + EnableProactiveGC bool `json:"enable_proactive_gc,omitempty" yaml:"enable_proactive_gc"` // EnableCopyOnWrite enables copy on write saving - EnableCopyOnWrite bool `yaml:"enable_copy_on_write" json:"enable_copy_on_write,omitempty"` + EnableCopyOnWrite bool `json:"enable_copy_on_write,omitempty" yaml:"enable_copy_on_write"` // VQueue represents the faiss vector queue buffer size VQueue *VQueue `json:"vqueue,omitempty" yaml:"vqueue"` diff --git a/internal/config/index.go b/internal/config/index.go index 2c08d6e67c..ab011f7b17 100644 --- a/internal/config/index.go +++ b/internal/config/index.go @@ -35,22 +35,22 @@ type Indexer struct { Concurrency int `json:"concurrency" yaml:"concurrency"` // AutoIndexDurationLimit represents auto indexing duration limit - AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit"` + AutoIndexDurationLimit string `json:"auto_index_duration_limit" yaml:"auto_index_duration_limit"` // AutoSaveIndexDurationLimit represents auto save index duration limit - AutoSaveIndexDurationLimit string `yaml:"auto_save_index_duration_limit" json:"auto_save_index_duration_limit"` + AutoSaveIndexDurationLimit string `json:"auto_save_index_duration_limit" yaml:"auto_save_index_duration_limit"` // AutoSaveIndexWaitDuration represents auto save index wait for next duration - AutoSaveIndexWaitDuration string `yaml:"auto_save_index_wait_duration" json:"auto_save_index_wait_duration"` + AutoSaveIndexWaitDuration string `json:"auto_save_index_wait_duration" yaml:"auto_save_index_wait_duration"` // AutoIndexCheckDuration represent checking loop duration about auto indexing execution - AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration"` + AutoIndexCheckDuration string `json:"auto_index_check_duration" yaml:"auto_index_check_duration"` // AutoIndexLength represent minimum auto index length - AutoIndexLength uint32 `yaml:"auto_index_length" json:"auto_index_length"` + AutoIndexLength uint32 `json:"auto_index_length" yaml:"auto_index_length"` // CreationPoolSize represent create index batch pool size - CreationPoolSize uint32 `yaml:"creation_pool_size" json:"creation_pool_size"` + CreationPoolSize uint32 `json:"creation_pool_size" yaml:"creation_pool_size"` // NodeName represents node name NodeName string `json:"node_name" yaml:"node_name"` diff --git a/internal/config/net.go b/internal/config/net.go index 176d17cb61..b76bccc7af 100644 --- a/internal/config/net.go +++ b/internal/config/net.go @@ -25,25 +25,25 @@ import ( // Net represents the network configuration tcp, udp, unix domain socket. type Net struct { - DNS *DNS `yaml:"dns" json:"dns,omitempty"` - Dialer *Dialer `yaml:"dialer" json:"dialer,omitempty"` - SocketOption *SocketOption `yaml:"socket_option" json:"socket_option,omitempty"` - TLS *TLS `yaml:"tls" json:"tls,omitempty"` + DNS *DNS `json:"dns,omitempty" yaml:"dns"` + Dialer *Dialer `json:"dialer,omitempty" yaml:"dialer"` + SocketOption *SocketOption `json:"socket_option,omitempty" yaml:"socket_option"` + TLS *TLS `json:"tls,omitempty" yaml:"tls"` } // Dialer represents the configuration for dial. type Dialer struct { - Timeout string `yaml:"timeout" json:"timeout,omitempty"` - Keepalive string `yaml:"keepalive" json:"keepalive,omitempty"` - FallbackDelay string `yaml:"fallback_delay" json:"fallback_delay,omitempty"` - DualStackEnabled bool `yaml:"dual_stack_enabled" json:"dual_stack_enabled,omitempty"` + Timeout string `json:"timeout,omitempty" yaml:"timeout"` + Keepalive string `json:"keepalive,omitempty" yaml:"keepalive"` + FallbackDelay string `json:"fallback_delay,omitempty" yaml:"fallback_delay"` + DualStackEnabled bool `json:"dual_stack_enabled,omitempty" yaml:"dual_stack_enabled"` } // DNS represents the configuration for resolving DNS. type DNS struct { - CacheEnabled bool `yaml:"cache_enabled" json:"cache_enabled,omitempty"` - RefreshDuration string `yaml:"refresh_duration" json:"refresh_duration,omitempty"` - CacheExpiration string `yaml:"cache_expiration" json:"cache_expiration,omitempty"` + CacheEnabled bool `json:"cache_enabled,omitempty" yaml:"cache_enabled"` + RefreshDuration string `json:"refresh_duration,omitempty" yaml:"refresh_duration"` + CacheExpiration string `json:"cache_expiration,omitempty" yaml:"cache_expiration"` } // SocketOption represents the socket configurations. diff --git a/internal/config/ngt.go b/internal/config/ngt.go index 6a9d8add9d..59b30af3c2 100644 --- a/internal/config/ngt.go +++ b/internal/config/ngt.go @@ -20,68 +20,68 @@ package config // NGT represent the ngt core configuration for server. type NGT struct { // IndexPath represent the ngt index file path - IndexPath string `yaml:"index_path" json:"index_path,omitempty"` + IndexPath string `json:"index_path,omitempty" yaml:"index_path"` // Dimension represent the ngt index dimension - Dimension int `yaml:"dimension" json:"dimension,omitempty" info:"dimension"` + Dimension int `info:"dimension" json:"dimension,omitempty" yaml:"dimension"` // BulkInsertChunkSize represent the bulk insert chunk size - BulkInsertChunkSize int `yaml:"bulk_insert_chunk_size" json:"bulk_insert_chunk_size,omitempty"` + BulkInsertChunkSize int `json:"bulk_insert_chunk_size,omitempty" yaml:"bulk_insert_chunk_size"` // DistanceType represent the ngt index distance type // it should be `l1`, `l2`, `angle`, `hamming`, `cosine`,`poincare`, `lorentz`, `jaccard`, `sparsejaccard`, `normalizedangle` or `normalizedcosine`. for further details about NGT libraries supported distance is https://github.com/yahoojapan/NGT/wiki/Command-Quick-Reference and vald agent's supported NGT distance type is https://pkg.go.dev/github.com/vdaas/vald/internal/core/algorithm/ngt#pkg-constants - DistanceType string `yaml:"distance_type" json:"distance_type,omitempty" info:"distance_type"` + DistanceType string `info:"distance_type" json:"distance_type,omitempty" yaml:"distance_type"` // ObjectType represent the ngt index object type float or int - ObjectType string `yaml:"object_type" json:"object_type,omitempty" info:"object_type"` + ObjectType string `info:"object_type" json:"object_type,omitempty" yaml:"object_type"` // CreationEdgeSize represent the index edge count - CreationEdgeSize int `yaml:"creation_edge_size" json:"creation_edge_size,omitempty"` + CreationEdgeSize int `json:"creation_edge_size,omitempty" yaml:"creation_edge_size"` // SearchEdgeSize represent the search edge size - SearchEdgeSize int `yaml:"search_edge_size" json:"search_edge_size,omitempty"` + SearchEdgeSize int `json:"search_edge_size,omitempty" yaml:"search_edge_size"` // AutoIndexDurationLimit represents auto indexing duration limit - AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit,omitempty"` + AutoIndexDurationLimit string `json:"auto_index_duration_limit,omitempty" yaml:"auto_index_duration_limit"` // AutoIndexCheckDuration represent checking loop duration about auto indexing execution - AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration,omitempty"` + AutoIndexCheckDuration string `json:"auto_index_check_duration,omitempty" yaml:"auto_index_check_duration"` // AutoSaveIndexDuration represent checking loop duration about auto save index execution - AutoSaveIndexDuration string `yaml:"auto_save_index_duration" json:"auto_save_index_duration,omitempty"` + AutoSaveIndexDuration string `json:"auto_save_index_duration,omitempty" yaml:"auto_save_index_duration"` // AutoIndexLength represent auto index length limit - AutoIndexLength int `yaml:"auto_index_length" json:"auto_index_length,omitempty"` + AutoIndexLength int `json:"auto_index_length,omitempty" yaml:"auto_index_length"` // InitialDelayMaxDuration represent maximum duration for initial delay - InitialDelayMaxDuration string `yaml:"initial_delay_max_duration" json:"initial_delay_max_duration,omitempty"` + InitialDelayMaxDuration string `json:"initial_delay_max_duration,omitempty" yaml:"initial_delay_max_duration"` // EnableInMemoryMode enables on memory ngt indexing mode - EnableInMemoryMode bool `yaml:"enable_in_memory_mode" json:"enable_in_memory_mode,omitempty"` + EnableInMemoryMode bool `json:"enable_in_memory_mode,omitempty" yaml:"enable_in_memory_mode"` // DefaultPoolSize represent default create index batch pool size - DefaultPoolSize uint32 `yaml:"default_pool_size" json:"default_pool_size,omitempty"` + DefaultPoolSize uint32 `json:"default_pool_size,omitempty" yaml:"default_pool_size"` // DefaultRadius represent default radius used for search - DefaultRadius float32 `yaml:"default_radius" json:"default_radius,omitempty"` + DefaultRadius float32 `json:"default_radius,omitempty" yaml:"default_radius"` // DefaultEpsilon represent default epsilon used for search - DefaultEpsilon float32 `yaml:"default_epsilon" json:"default_epsilon,omitempty"` + DefaultEpsilon float32 `json:"default_epsilon,omitempty" yaml:"default_epsilon"` // MinLoadIndexTimeout represents minimum duration of load index timeout - MinLoadIndexTimeout string `yaml:"min_load_index_timeout" json:"min_load_index_timeout,omitempty"` + MinLoadIndexTimeout string `json:"min_load_index_timeout,omitempty" yaml:"min_load_index_timeout"` // MaxLoadIndexTimeout represents maximum duration of load index timeout - MaxLoadIndexTimeout string `yaml:"max_load_index_timeout" json:"max_load_index_timeout,omitempty"` + MaxLoadIndexTimeout string `json:"max_load_index_timeout,omitempty" yaml:"max_load_index_timeout"` // LoadIndexTimeoutFactor represents a factor of load index timeout - LoadIndexTimeoutFactor string `yaml:"load_index_timeout_factor" json:"load_index_timeout_factor,omitempty"` + LoadIndexTimeoutFactor string `json:"load_index_timeout_factor,omitempty" yaml:"load_index_timeout_factor"` // EnableProactiveGC enables more proactive GC call for reducing heap memory allocation - EnableProactiveGC bool `yaml:"enable_proactive_gc" json:"enable_proactive_gc,omitempty"` + EnableProactiveGC bool `json:"enable_proactive_gc,omitempty" yaml:"enable_proactive_gc"` // EnableCopyOnWrite enables copy on write saving - EnableCopyOnWrite bool `yaml:"enable_copy_on_write" json:"enable_copy_on_write,omitempty"` + EnableCopyOnWrite bool `json:"enable_copy_on_write,omitempty" yaml:"enable_copy_on_write"` // VQueue represent the ngt vector queue buffer size VQueue *VQueue `json:"vqueue,omitempty" yaml:"vqueue"` @@ -90,13 +90,13 @@ type NGT struct { KVSDB *KVSDB `json:"kvsdb,omitempty" yaml:"kvsdb"` // BrokenIndexHistoryLimit represents the maximum number of broken index generations that will be backed up - BrokenIndexHistoryLimit int `yaml:"broken_index_history_limit" json:"broken_index_history_limit,omitempty"` + BrokenIndexHistoryLimit int `json:"broken_index_history_limit,omitempty" yaml:"broken_index_history_limit"` // ErrorBufferLimit represents the maximum number of core ngt error buffer pool size limit - ErrorBufferLimit uint64 `yaml:"error_buffer_limit" json:"error_buffer_limit,omitempty"` + ErrorBufferLimit uint64 `json:"error_buffer_limit,omitempty" yaml:"error_buffer_limit"` // IsReadReplica represents whether the ngt is read replica or not - IsReadReplica bool `yaml:"is_readreplica" json:"is_readreplica"` + IsReadReplica bool `json:"is_readreplica" yaml:"is_readreplica"` } // KVSDB represent the ngt vector bidirectional kv store configuration diff --git a/internal/config/server.go b/internal/config/server.go index edbf04d06f..e147d86f3b 100644 --- a/internal/config/server.go +++ b/internal/config/server.go @@ -39,7 +39,7 @@ type Servers struct { MetricsServers []*Server `json:"metrics_servers" yaml:"metrics_servers"` // StartUpStrategy represent starting order of server name - StartUpStrategy []string `json:"startup_strategy" yaml:"startup_strategy"` + StartUpStrategy []string `json:"startup_strategy" yaml:"startup_strategy"` // ShutdownStrategy represent shutdown order of server name ShutdownStrategy []string `json:"shutdown_strategy" yaml:"shutdown_strategy"` diff --git a/internal/config/sidecar.go b/internal/config/sidecar.go index 2843c60a1a..f7045bd673 100644 --- a/internal/config/sidecar.go +++ b/internal/config/sidecar.go @@ -20,43 +20,43 @@ package config // AgentSidecar represents the configuration for the agent sidecar. type AgentSidecar struct { // Mode represents sidecar mode - Mode string `yaml:"mode" json:"mode"` + Mode string `json:"mode" yaml:"mode"` // WatchDir represents watch target directory for backup - WatchDir string `yaml:"watch_dir" json:"watch_dir"` + WatchDir string `json:"watch_dir" yaml:"watch_dir"` // WatchEnabled represent auto backup triggered by file changes is enabled or not - WatchEnabled bool `yaml:"watch_enabled" json:"watch_enabled"` + WatchEnabled bool `json:"watch_enabled" yaml:"watch_enabled"` // AutoBackupEnabled represent auto backup triggered by timer is enabled or not - AutoBackupEnabled bool `yaml:"auto_backup_enabled" json:"auto_backup_enabled"` + AutoBackupEnabled bool `json:"auto_backup_enabled" yaml:"auto_backup_enabled"` // AutoBackupDuration represent checking loop duration for auto backup execution - AutoBackupDuration string `yaml:"auto_backup_duration" json:"auto_backup_duration"` + AutoBackupDuration string `json:"auto_backup_duration" yaml:"auto_backup_duration"` // PostStopTimeout represent timeout duration for file changing during post stop - PostStopTimeout string `yaml:"post_stop_timeout" json:"post_stop_timeout"` + PostStopTimeout string `json:"post_stop_timeout" yaml:"post_stop_timeout"` // Filename represent backup filename - Filename string `yaml:"filename" json:"filename"` + Filename string `json:"filename" yaml:"filename"` // FilenameSuffix represent suffix of backup filename - FilenameSuffix string `yaml:"filename_suffix" json:"filename_suffix"` + FilenameSuffix string `json:"filename_suffix" yaml:"filename_suffix"` // BlobStorage represent blob storage configurations - BlobStorage *Blob `yaml:"blob_storage" json:"blob_storage"` + BlobStorage *Blob `json:"blob_storage" yaml:"blob_storage"` // Compress represent compression configurations - Compress *CompressCore `yaml:"compress" json:"compress"` + Compress *CompressCore `json:"compress" yaml:"compress"` // RestoreBackoffEnabled represent backoff enabled or not - RestoreBackoffEnabled bool `yaml:"restore_backoff_enabled" json:"restore_backoff_enabled"` + RestoreBackoffEnabled bool `json:"restore_backoff_enabled" yaml:"restore_backoff_enabled"` // RestoreBackoff represent backoff configurations for restoring process - RestoreBackoff *Backoff `yaml:"restore_backoff" json:"restore_backoff"` + RestoreBackoff *Backoff `json:"restore_backoff" yaml:"restore_backoff"` // Client represent HTTP client configurations - Client *Client `yaml:"client" json:"client"` + Client *Client `json:"client" yaml:"client"` } // Bind binds the actual data from the AgentSidecar receiver fields. diff --git a/internal/config/tls.go b/internal/config/tls.go index d602356fcc..4b279e06d4 100644 --- a/internal/config/tls.go +++ b/internal/config/tls.go @@ -22,19 +22,19 @@ import "github.com/vdaas/vald/internal/tls" // TLS represent the TLS configuration for server. type TLS struct { // Enable represent the server enable TLS or not. - Enabled bool `yaml:"enabled" json:"enabled"` + Enabled bool `json:"enabled" yaml:"enabled"` // Cert represent the certificate environment variable key used to start server. - Cert string `yaml:"cert" json:"cert"` + Cert string `json:"cert" yaml:"cert"` // Key represent the private key environment variable key used to start server. - Key string `yaml:"key" json:"key"` + Key string `json:"key" yaml:"key"` // CA represent the CA certificate environment variable key used to start server. - CA string `yaml:"ca" json:"ca"` + CA string `json:"ca" yaml:"ca"` // InsecureSkipVerify represent enable/disable skip SSL certificate verification - InsecureSkipVerify bool `yaml:"insecure_skip_verify" json:"insecure_skip_verify"` + InsecureSkipVerify bool `json:"insecure_skip_verify" yaml:"insecure_skip_verify"` } // Bind returns TLS object whose every value except Enabled is field value of environment value. diff --git a/internal/config/transport.go b/internal/config/transport.go index cd928f648d..ba256ec9de 100644 --- a/internal/config/transport.go +++ b/internal/config/transport.go @@ -19,23 +19,23 @@ package config // TCP represents the TCP configuration for server. type Transport struct { - RoundTripper *RoundTripper `yaml:"round_tripper" json:"round_tripper"` - Backoff *Backoff `yaml:"backoff" json:"backoff"` + RoundTripper *RoundTripper `json:"round_tripper" yaml:"round_tripper"` + Backoff *Backoff `json:"backoff" yaml:"backoff"` } // RoundTripper represents the round trip configuration for transport. type RoundTripper struct { - TLSHandshakeTimeout string `yaml:"tls_handshake_timeout" json:"tls_handshake_timeout"` - MaxIdleConns int `yaml:"max_idle_conns" json:"max_idle_conns"` - MaxIdleConnsPerHost int `yaml:"max_idle_conns_per_host" json:"max_idle_conns_per_host"` - MaxConnsPerHost int `yaml:"max_conns_per_host" json:"max_conns_per_host"` - IdleConnTimeout string `yaml:"idle_conn_timeout" json:"idle_conn_timeout"` - ResponseHeaderTimeout string `yaml:"response_header_timeout" json:"response_header_timeout"` - ExpectContinueTimeout string `yaml:"expect_continue_timeout" json:"expect_continue_timeout"` - MaxResponseHeaderSize int64 `yaml:"max_response_header_size" json:"max_response_header_size"` - WriteBufferSize int64 `yaml:"write_buffer_size" json:"write_buffer_size"` - ReadBufferSize int64 `yaml:"read_buffer_size" json:"read_buffer_size"` - ForceAttemptHTTP2 bool `yaml:"force_attempt_http_2" json:"force_attempt_http_2"` + TLSHandshakeTimeout string `json:"tls_handshake_timeout" yaml:"tls_handshake_timeout"` + MaxIdleConns int `json:"max_idle_conns" yaml:"max_idle_conns"` + MaxIdleConnsPerHost int `json:"max_idle_conns_per_host" yaml:"max_idle_conns_per_host"` + MaxConnsPerHost int `json:"max_conns_per_host" yaml:"max_conns_per_host"` + IdleConnTimeout string `json:"idle_conn_timeout" yaml:"idle_conn_timeout"` + ResponseHeaderTimeout string `json:"response_header_timeout" yaml:"response_header_timeout"` + ExpectContinueTimeout string `json:"expect_continue_timeout" yaml:"expect_continue_timeout"` + MaxResponseHeaderSize int64 `json:"max_response_header_size" yaml:"max_response_header_size"` + WriteBufferSize int64 `json:"write_buffer_size" yaml:"write_buffer_size"` + ReadBufferSize int64 `json:"read_buffer_size" yaml:"read_buffer_size"` + ForceAttemptHTTP2 bool `json:"force_attempt_http_2" yaml:"force_attempt_http_2"` } // Bind binds the actual data from the RoundTripper receiver fields. diff --git a/internal/k8s/vald/benchmark/api/v1/job_types.go b/internal/k8s/vald/benchmark/api/v1/job_types.go index b6e07488cd..fe62f3414b 100644 --- a/internal/k8s/vald/benchmark/api/v1/job_types.go +++ b/internal/k8s/vald/benchmark/api/v1/job_types.go @@ -23,7 +23,7 @@ import ( ) type BenchmarkJobSpec struct { - *config.GlobalConfig `json:",omitempty" yaml:""` + *config.GlobalConfig `json:",omitempty" yaml:""` ServerConfig *config.Servers `json:"server_config,omitempty" yaml:"server_config"` Target *BenchmarkTarget `json:"target,omitempty" yaml:"target"` Dataset *BenchmarkDataset `json:"dataset,omitempty" yaml:"dataset"` diff --git a/pkg/tools/cli/loadtest/config/config.go b/pkg/tools/cli/loadtest/config/config.go index 23a084ec5f..1a6422dd2a 100644 --- a/pkg/tools/cli/loadtest/config/config.go +++ b/pkg/tools/cli/loadtest/config/config.go @@ -73,7 +73,7 @@ func (o Operation) String() string { // Data represent a application setting data content (config.yaml). // In K8s environment, this configuration is stored in K8s ConfigMap. type Data struct { - config.GlobalConfig `json:",inline" yaml:",inline"` + config.GlobalConfig `json:",inline" yaml:",inline"` Addr string `json:"addr" yaml:"addr"` Operation string `json:"operation" yaml:"operation"` Dataset string `json:"dataset" yaml:"dataset"` From 940e45a3cf416c6042b12440b1cc5343794e7f42 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Tue, 13 Feb 2024 05:29:05 +0000 Subject: [PATCH 3/5] fix indent --- pkg/tools/cli/loadtest/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tools/cli/loadtest/config/config.go b/pkg/tools/cli/loadtest/config/config.go index 1a6422dd2a..7807ac49d8 100644 --- a/pkg/tools/cli/loadtest/config/config.go +++ b/pkg/tools/cli/loadtest/config/config.go @@ -73,7 +73,7 @@ func (o Operation) String() string { // Data represent a application setting data content (config.yaml). // In K8s environment, this configuration is stored in K8s ConfigMap. type Data struct { - config.GlobalConfig `json:",inline" yaml:",inline"` + config.GlobalConfig `json:",inline" yaml:",inline"` Addr string `json:"addr" yaml:"addr"` Operation string `json:"operation" yaml:"operation"` Dataset string `json:"dataset" yaml:"dataset"` From 0b7df25525279046497e542f3bbf4dd7c590023b Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 05:29:01 +0000 Subject: [PATCH 4/5] style: format code with Gofumpt and Prettier This commit fixes the style issues introduced in 940e45a according to the output from Gofumpt and Prettier. Details: https://github.com/vdaas/vald/pull/2326 --- pkg/tools/cli/loadtest/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tools/cli/loadtest/config/config.go b/pkg/tools/cli/loadtest/config/config.go index 7807ac49d8..1a6422dd2a 100644 --- a/pkg/tools/cli/loadtest/config/config.go +++ b/pkg/tools/cli/loadtest/config/config.go @@ -73,7 +73,7 @@ func (o Operation) String() string { // Data represent a application setting data content (config.yaml). // In K8s environment, this configuration is stored in K8s ConfigMap. type Data struct { - config.GlobalConfig `json:",inline" yaml:",inline"` + config.GlobalConfig `json:",inline" yaml:",inline"` Addr string `json:"addr" yaml:"addr"` Operation string `json:"operation" yaml:"operation"` Dataset string `json:"dataset" yaml:"dataset"` From db14830d7c1f85e2e372c82759e936deaaab64e0 Mon Sep 17 00:00:00 2001 From: ykadowak Date: Tue, 13 Feb 2024 05:39:48 +0000 Subject: [PATCH 5/5] ignore tagaline from config.go --- internal/k8s/vald/benchmark/api/v1/job_types.go | 3 ++- pkg/tools/cli/loadtest/config/config.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/k8s/vald/benchmark/api/v1/job_types.go b/internal/k8s/vald/benchmark/api/v1/job_types.go index fe62f3414b..9114fde0c1 100644 --- a/internal/k8s/vald/benchmark/api/v1/job_types.go +++ b/internal/k8s/vald/benchmark/api/v1/job_types.go @@ -23,7 +23,8 @@ import ( ) type BenchmarkJobSpec struct { - *config.GlobalConfig `json:",omitempty" yaml:""` + //nolint: tagalign + *config.GlobalConfig `json:",omitempty" yaml:""` ServerConfig *config.Servers `json:"server_config,omitempty" yaml:"server_config"` Target *BenchmarkTarget `json:"target,omitempty" yaml:"target"` Dataset *BenchmarkDataset `json:"dataset,omitempty" yaml:"dataset"` diff --git a/pkg/tools/cli/loadtest/config/config.go b/pkg/tools/cli/loadtest/config/config.go index 1a6422dd2a..dd73b5308d 100644 --- a/pkg/tools/cli/loadtest/config/config.go +++ b/pkg/tools/cli/loadtest/config/config.go @@ -73,7 +73,8 @@ func (o Operation) String() string { // Data represent a application setting data content (config.yaml). // In K8s environment, this configuration is stored in K8s ConfigMap. type Data struct { - config.GlobalConfig `json:",inline" yaml:",inline"` + //nolint: tagalign + config.GlobalConfig `json:",inline" yaml:",inline"` Addr string `json:"addr" yaml:"addr"` Operation string `json:"operation" yaml:"operation"` Dataset string `json:"dataset" yaml:"dataset"`