diff --git a/Makefile.d/functions.mk b/Makefile.d/functions.mk index bfa81d228d..cedeab447c 100644 --- a/Makefile.d/functions.mk +++ b/Makefile.d/functions.mk @@ -42,7 +42,7 @@ define profile-web endef define go-lint - golangci-lint run --config .golangci.yml + golangci-lint run --config .golangci.yml --fix endef define go-vet diff --git a/charts/vald/values.go b/charts/vald/values.go index 5c6a200510..318b87248a 100644 --- a/charts/vald/values.go +++ b/charts/vald/values.go @@ -17,14 +17,14 @@ import ( "github.com/vdaas/vald/internal/config" ) -// Affinity +// Affinity. type Affinity struct { NodeAffinity *NodeAffinity `json:"nodeAffinity,omitempty"` PodAffinity *PodAffinity `json:"podAffinity,omitempty"` PodAntiAffinity *PodAntiAffinity `json:"podAntiAffinity,omitempty"` } -// Agent +// Agent. type Agent struct { Affinity *Affinity `json:"affinity,omitempty"` @@ -121,10 +121,10 @@ type Agent struct { Volumes []*VolumesItems `json:"volumes,omitempty"` } -// Annotations deployment annotations +// Annotations deployment annotations. type Annotations map[string]string -// BlobStorage +// BlobStorage. type BlobStorage struct { // bucket name Bucket string `json:"bucket,omitempty"` @@ -135,7 +135,7 @@ type BlobStorage struct { StorageType string `json:"storage_type,omitempty"` } -// CloudStorage +// CloudStorage. type CloudStorage struct { Client *config.GRPCClient `json:"client,omitempty"` @@ -161,7 +161,7 @@ type CloudStorage struct { WriteContentType string `json:"write_content_type,omitempty"` } -// ClusterRole +// ClusterRole. type ClusterRole struct { // creates clusterRole resource Enabled bool `json:"enabled,omitempty"` @@ -170,7 +170,7 @@ type ClusterRole struct { Name string `json:"name,omitempty"` } -// ClusterRoleBinding +// ClusterRoleBinding. type ClusterRoleBinding struct { // creates clusterRoleBinding resource Enabled bool `json:"enabled,omitempty"` @@ -179,14 +179,14 @@ type ClusterRoleBinding struct { Name string `json:"name,omitempty"` } -// Collector +// Collector. type Collector struct { // metrics collect duration. if it is set as 5s, enabled metrics are collected every 5 seconds. Duration string `json:"duration,omitempty"` Metrics *Metrics `json:"metrics,omitempty"` } -// Compress +// Compress. type Compress struct { // compression algorithm. must be `gob`, `gzip`, `lz4` or `zstd` CompressAlgorithm string `json:"compress_algorithm,omitempty"` @@ -195,7 +195,7 @@ type Compress struct { CompressionLevel int `json:"compression_level,omitempty"` } -// Config +// Config. type Config struct { // auto backup duration AutoBackupDuration string `json:"auto_backup_duration,omitempty"` @@ -223,7 +223,7 @@ type Config struct { WatchEnabled bool `json:"watch_enabled,omitempty"` } -// Defaults +// Defaults. type Defaults struct { Grpc *Grpc `json:"grpc,omitempty"` Image *Image `json:"image,omitempty"` @@ -236,7 +236,7 @@ type Defaults struct { TimeZone string `json:"time_zone,omitempty"` } -// Dialer +// Dialer. type Dialer struct { // gRPC client TCP dialer dual stack enabled DualStackEnabled bool `json:"dual_stack_enabled,omitempty"` @@ -248,7 +248,7 @@ type Dialer struct { Timeout string `json:"timeout,omitempty"` } -// Discoverer +// Discoverer. type Discoverer struct { AgentClientOptions *config.GRPCClient `json:"agent_client_options,omitempty"` Client *config.GRPCClient `json:"client,omitempty"` @@ -257,7 +257,7 @@ type Discoverer struct { Duration string `json:"duration,omitempty"` } -// Dns +// Dns. type Dns struct { // gRPC client TCP DNS cache enabled CacheEnabled bool `json:"cache_enabled,omitempty"` @@ -269,7 +269,7 @@ type Dns struct { RefreshDuration string `json:"refresh_duration,omitempty"` } -// EgressFilter gRPC client config for egress filter +// EgressFilter gRPC client config for egress filter. type EgressFilter struct { Client *config.GRPCClient `json:"client,omitempty"` @@ -280,13 +280,13 @@ type EgressFilter struct { ObjectFilters []string `json:"object_filters,omitempty"` } -// EnvItems +// EnvItems. type EnvItems struct{} -// Fields k8s field selectors for pod discovery +// Fields k8s field selectors for pod discovery. type Fields struct{} -// Filter +// Filter. type Filter struct { Affinity *Affinity `json:"affinity,omitempty"` @@ -379,13 +379,13 @@ type Filter struct { Volumes []*VolumesItems `json:"volumes,omitempty"` } -// Gateway +// Gateway. type Gateway struct { Filter *Filter `json:"filter,omitempty"` Lb *Lb `json:"lb,omitempty"` } -// GatewayConfig +// GatewayConfig. type GatewayConfig struct { // gRPC client config for egress filter EgressFilter *EgressFilter `json:"egress_filter,omitempty"` @@ -395,7 +395,7 @@ type GatewayConfig struct { IngressFilter *IngressFilter `json:"ingress_filter,omitempty"` } -// Grpc +// Grpc. type Grpc struct { // gRPC server enabled Enabled bool `json:"enabled,omitempty"` @@ -411,14 +411,14 @@ type Grpc struct { ServicePort int `json:"servicePort,omitempty"` } -// Healths +// Healths. type Healths struct { Liveness *Liveness `json:"liveness,omitempty"` Readiness *Readiness `json:"readiness,omitempty"` Startup *Startup `json:"startup,omitempty"` } -// Hpa +// Hpa. type Hpa struct { // HPA enabled Enabled bool `json:"enabled,omitempty"` @@ -427,7 +427,7 @@ type Hpa struct { TargetCPUUtilizationPercentage int `json:"targetCPUUtilizationPercentage,omitempty"` } -// Http +// Http. type Http struct { // REST server handler timeout HandlerTimeout string `json:"handler_timeout,omitempty"` @@ -448,7 +448,7 @@ type Http struct { WriteTimeout string `json:"write_timeout,omitempty"` } -// HttpGet +// HttpGet. type HttpGet struct { // startup probe path Path string `json:"path,omitempty"` @@ -460,7 +460,7 @@ type HttpGet struct { Scheme string `json:"scheme,omitempty"` } -// Image +// Image. type Image struct { // image pull policy PullPolicy string `json:"pullPolicy,omitempty"` @@ -472,7 +472,7 @@ type Image struct { Tag string `json:"tag,omitempty"` } -// Index +// Index. type Index struct { Affinity *Affinity `json:"affinity,omitempty"` @@ -560,7 +560,7 @@ type Index struct { Volumes []*VolumesItems `json:"volumes,omitempty"` } -// Indexer +// Indexer. type Indexer struct { // namespace of agent pods to manage AgentNamespace string `json:"agent_namespace,omitempty"` @@ -591,7 +591,7 @@ type Indexer struct { NodeName string `json:"node_name,omitempty"` } -// Ingress +// Ingress. type Ingress struct { // annotations for ingress Annotations *Annotations `json:"annotations,omitempty"` @@ -609,7 +609,7 @@ type Ingress struct { ServicePort string `json:"servicePort,omitempty"` } -// IngressFilter gRPC client config for ingress filter +// IngressFilter gRPC client config for ingress filter. type IngressFilter struct { Client *config.GRPCClient `json:"client,omitempty"` @@ -629,7 +629,7 @@ type IngressFilter struct { Vectorizer string `json:"vectorizer,omitempty"` } -// InitContainersItems +// InitContainersItems. type InitContainersItems struct { Type string Name string @@ -638,10 +638,10 @@ type InitContainersItems struct { SleepDuration int } -// Initializer +// Initializer. type Initializer struct{} -// Jaeger +// Jaeger. type Jaeger struct { // Jaeger agent endpoint AgentEndpoint string `json:"agent_endpoint,omitempty"` @@ -680,7 +680,7 @@ type Jaeger struct { MaxQueueSize int `json:"max_queue_size,omitempty"` } -// Keepalive +// Keepalive. type Keepalive struct { // gRPC client keep alive permit without stream PermitWithoutStream bool `json:"permit_without_stream,omitempty"` @@ -692,16 +692,16 @@ type Keepalive struct { Timeout string `json:"timeout,omitempty"` } -// Kvsdb +// Kvsdb. type Kvsdb struct { // kvsdb processing concurrency Concurrency int `json:"concurrency,omitempty"` } -// Labels service labels +// Labels service labels. type Labels map[string]string -// Lb +// Lb. type Lb struct { Affinity *Affinity `json:"affinity,omitempty"` @@ -794,10 +794,10 @@ type Lb struct { Volumes []*VolumesItems `json:"volumes,omitempty"` } -// Limits +// Limits. type Limits struct{} -// Liveness +// Liveness. type Liveness struct { // liveness server enabled Enabled bool `json:"enabled,omitempty"` @@ -814,7 +814,7 @@ type Liveness struct { ServicePort int `json:"servicePort,omitempty"` } -// LivenessProbe +// LivenessProbe. type LivenessProbe struct { // liveness probe failure threshold FailureThreshold int `json:"failureThreshold,omitempty"` @@ -833,7 +833,7 @@ type LivenessProbe struct { TimeoutSeconds int `json:"timeoutSeconds,omitempty"` } -// Logging +// Logging. type Logging struct { // logging format. logging format must be `raw` or `json` Format string `json:"format,omitempty"` @@ -845,12 +845,12 @@ type Logging struct { Logger string `json:"logger,omitempty"` } -// Manager +// Manager. type Manager struct { Index *Index `json:"index,omitempty"` } -// Metrics +// Metrics. type Metrics struct { // CGO metrics enabled EnableCgo bool `json:"enable_cgo,omitempty"` @@ -868,7 +868,7 @@ type Metrics struct { VersionInfoLabels []string `json:"version_info_labels,omitempty"` } -// Node k8s resource selectors for node discovery +// Node k8s resource selectors for node discovery. type Node struct { // k8s field selectors for node discovery Fields *Fields `json:"fields,omitempty"` @@ -876,14 +876,14 @@ type Node struct { Labels *Labels `json:"labels,omitempty"` } -// NodeAffinity +// NodeAffinity. type NodeAffinity struct { // node affinity preferred scheduling terms PreferredDuringSchedulingIgnoredDuringExecution []*PreferredDuringSchedulingIgnoredDuringExecutionItems `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` RequiredDuringSchedulingIgnoredDuringExecution *RequiredDuringSchedulingIgnoredDuringExecution `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` } -// NodeMetrics k8s resource selectors for node_metrics discovery +// NodeMetrics k8s resource selectors for node_metrics discovery. type NodeMetrics struct { // k8s field selectors for node_metrics discovery Fields *Fields `json:"fields,omitempty"` @@ -892,13 +892,13 @@ type NodeMetrics struct { Labels *Labels `json:"labels,omitempty"` } -// NodeSelector node selector +// NodeSelector node selector. type NodeSelector struct{} -// NodeSelectorTermsItems +// NodeSelectorTermsItems. type NodeSelectorTermsItems struct{} -// Observability +// Observability. type Observability struct { Metrics *Metrics `json:"metrics,omitempty"` @@ -909,7 +909,7 @@ type Observability struct { Trace *Trace `json:"trace,omitempty"` } -// PersistentVolume +// PersistentVolume. type PersistentVolume struct { // agent pod storage accessMode AccessMode string `json:"accessMode,omitempty"` @@ -924,7 +924,7 @@ type PersistentVolume struct { StorageClass string `json:"storageClass,omitempty"` } -// Pod k8s resource selectors for pod discovery +// Pod k8s resource selectors for pod discovery. type Pod struct { // k8s field selectors for pod discovery Fields *Fields `json:"fields,omitempty"` @@ -933,7 +933,7 @@ type Pod struct { Labels *Labels `json:"labels,omitempty"` } -// PodAffinity +// PodAffinity. type PodAffinity struct { // pod affinity preferred scheduling terms PreferredDuringSchedulingIgnoredDuringExecution []*PreferredDuringSchedulingIgnoredDuringExecutionItems `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` @@ -942,10 +942,10 @@ type PodAffinity struct { RequiredDuringSchedulingIgnoredDuringExecution []*RequiredDuringSchedulingIgnoredDuringExecutionItems `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` } -// PodAnnotations pod annotations +// PodAnnotations pod annotations. type PodAnnotations struct{} -// PodAntiAffinity +// PodAntiAffinity. type PodAntiAffinity struct { // pod anti-affinity preferred scheduling terms PreferredDuringSchedulingIgnoredDuringExecution []*PreferredDuringSchedulingIgnoredDuringExecutionItems `json:"preferredDuringSchedulingIgnoredDuringExecution,omitempty"` @@ -954,7 +954,7 @@ type PodAntiAffinity struct { RequiredDuringSchedulingIgnoredDuringExecution []*RequiredDuringSchedulingIgnoredDuringExecutionItems `json:"requiredDuringSchedulingIgnoredDuringExecution,omitempty"` } -// PodMetrics k8s resource selectors for pod_metrics discovery +// PodMetrics k8s resource selectors for pod_metrics discovery. type PodMetrics struct { // k8s field selectors for pod_metrics discovery Fields *Fields `json:"fields,omitempty"` @@ -963,7 +963,7 @@ type PodMetrics struct { Labels *Labels `json:"labels,omitempty"` } -// PodPriority +// PodPriority. type PodPriority struct { // gateway pod PriorityClass enabled Enabled bool `json:"enabled,omitempty"` @@ -972,10 +972,10 @@ type PodPriority struct { Value int `json:"value,omitempty"` } -// PodSecurityContext security context for pod +// PodSecurityContext security context for pod. type PodSecurityContext struct{} -// Pprof +// Pprof. type Pprof struct { // pprof server enabled Enabled bool `json:"enabled,omitempty"` @@ -991,10 +991,10 @@ type Pprof struct { ServicePort int `json:"servicePort,omitempty"` } -// PreferredDuringSchedulingIgnoredDuringExecutionItems +// PreferredDuringSchedulingIgnoredDuringExecutionItems. type PreferredDuringSchedulingIgnoredDuringExecutionItems struct{} -// Prometheus +// Prometheus. type Prometheus struct { // Prometheus exporter enabled Enabled bool `json:"enabled,omitempty"` @@ -1015,7 +1015,7 @@ type Prometheus struct { EnableInMemoryMode bool `json:"enable_in_memory_mode,omitempty"` } -// Readiness +// Readiness. type Readiness struct { // readiness server enabled Enabled bool `json:"enabled,omitempty"` @@ -1032,7 +1032,7 @@ type Readiness struct { ServicePort int `json:"servicePort,omitempty"` } -// ReadinessProbe +// ReadinessProbe. type ReadinessProbe struct { // readiness probe failure threshold FailureThreshold int `json:"failureThreshold,omitempty"` @@ -1051,25 +1051,25 @@ type ReadinessProbe struct { TimeoutSeconds int `json:"timeoutSeconds,omitempty"` } -// Requests +// Requests. type Requests struct{} -// RequiredDuringSchedulingIgnoredDuringExecution +// RequiredDuringSchedulingIgnoredDuringExecution. type RequiredDuringSchedulingIgnoredDuringExecution struct { // node affinity required node selectors NodeSelectorTerms []*NodeSelectorTermsItems `json:"nodeSelectorTerms,omitempty"` } -// RequiredDuringSchedulingIgnoredDuringExecutionItems +// RequiredDuringSchedulingIgnoredDuringExecutionItems. type RequiredDuringSchedulingIgnoredDuringExecutionItems struct{} -// Resources compute resources +// Resources compute resources. type Resources struct { Limits *Limits `json:"limits,omitempty"` Requests *Requests `json:"requests,omitempty"` } -// Rest +// Rest. type Rest struct { // REST server enabled Enabled bool `json:"enabled,omitempty"` @@ -1085,7 +1085,7 @@ type Rest struct { ServicePort int `json:"servicePort,omitempty"` } -// RollingUpdate +// RollingUpdate. type RollingUpdate struct { // max surge of rolling update MaxSurge string `json:"maxSurge,omitempty"` @@ -1094,7 +1094,7 @@ type RollingUpdate struct { MaxUnavailable string `json:"maxUnavailable,omitempty"` } -// S3 +// S3. type S3 struct { // s3 access key AccessKey string `json:"access_key,omitempty"` @@ -1151,10 +1151,10 @@ type S3 struct { UseDualStack bool `json:"use_dual_stack,omitempty"` } -// SecurityContext security context for container +// SecurityContext security context for container. type SecurityContext struct{} -// Selectors k8s resource selectors +// Selectors k8s resource selectors. type Selectors struct { // k8s resource selectors for node discovery Node *Node `json:"node,omitempty"` @@ -1169,7 +1169,7 @@ type Selectors struct { PodMetrics *PodMetrics `json:"pod_metrics,omitempty"` } -// Server +// Server. type Server struct { Http *Http `json:"http,omitempty"` @@ -1187,7 +1187,7 @@ type Server struct { SocketPath string `json:"socket_path,omitempty"` } -// ServerConfig +// ServerConfig. type ServerConfig struct { // server full shutdown duration FullShutdownDuration string `json:"full_shutdown_duration,omitempty"` @@ -1197,13 +1197,13 @@ type ServerConfig struct { Tls *Tls `json:"tls,omitempty"` } -// Servers +// Servers. type Servers struct { Grpc *Grpc `json:"grpc,omitempty"` Rest *Rest `json:"rest,omitempty"` } -// Service +// Service. type Service struct { // service annotations Annotations *Annotations `json:"annotations,omitempty"` @@ -1212,7 +1212,7 @@ type Service struct { Labels *Labels `json:"labels,omitempty"` } -// ServiceAccount +// ServiceAccount. type ServiceAccount struct { // creates service account Enabled bool `json:"enabled,omitempty"` @@ -1221,7 +1221,7 @@ type ServiceAccount struct { Name string `json:"name,omitempty"` } -// Sidecar +// Sidecar. type Sidecar struct { Config *Config `json:"config,omitempty"` @@ -1252,7 +1252,7 @@ type Sidecar struct { Version string `json:"version,omitempty"` } -// Startup +// Startup. type Startup struct { // startup server enabled Enabled bool `json:"enabled,omitempty"` @@ -1262,7 +1262,7 @@ type Startup struct { StartupProbe *StartupProbe `json:"startupProbe,omitempty"` } -// StartupProbe +// StartupProbe. type StartupProbe struct { // startup probe failure threshold FailureThreshold int `json:"failureThreshold,omitempty"` @@ -1281,7 +1281,7 @@ type StartupProbe struct { TimeoutSeconds int `json:"timeoutSeconds,omitempty"` } -// Tls +// Tls. type Tls struct { // TLS ca path Ca string `json:"ca,omitempty"` @@ -1299,19 +1299,19 @@ type Tls struct { Key string `json:"key,omitempty"` } -// TolerationsItems +// TolerationsItems. type TolerationsItems struct{} -// TopologySpreadConstraintsItems +// TopologySpreadConstraintsItems. type TopologySpreadConstraintsItems struct{} -// Trace +// Trace. type Trace struct { // trace enabled Enabled bool `json:"enabled,omitempty"` } -// Values +// Values. type Values struct { Agent *Agent `json:"agent,omitempty"` Defaults *Defaults `json:"defaults,omitempty"` @@ -1321,13 +1321,13 @@ type Values struct { Manager *Manager `json:"manager,omitempty"` } -// VolumeMountsItems +// VolumeMountsItems. type VolumeMountsItems struct{} -// VolumesItems +// VolumesItems. type VolumesItems struct{} -// Vqueue +// Vqueue. type VQueue struct { // delete slice pool buffer size DeleteBufferPoolSize int `json:"delete_buffer_pool_size,omitempty"` diff --git a/internal/backoff/context.go b/internal/backoff/context.go index 948c070b18..1ea7e7c199 100644 --- a/internal/backoff/context.go +++ b/internal/backoff/context.go @@ -38,7 +38,7 @@ func FromBackoffName(ctx context.Context) string { return "" } -// isRunning returns context and is running or not for preventing duplicated backoff execution +// isRunning returns context and is running or not for preventing duplicated backoff execution. func isRunning(ctx context.Context) (context.Context, bool) { if val := ctx.Value(backoffRunningContextKey); val != nil { if v, ok := val.(string); ok && v == backoffRunningContextValue { diff --git a/internal/client/v1/client/discoverer/discover_test.go b/internal/client/v1/client/discoverer/discover_test.go index 345d68eb3f..491f2ba3c5 100644 --- a/internal/client/v1/client/discoverer/discover_test.go +++ b/internal/client/v1/client/discoverer/discover_test.go @@ -66,7 +66,7 @@ func Test_client_GetReadClient(t *testing.T) { client: &mockClient, readClient: &mockReadClient, readReplicaReplicas: 1, - //nolint: govet,copylocks + //nolint:govet,copylocks //skipcq: VET-V0008 roundRobin: counter, }, @@ -82,7 +82,7 @@ func Test_client_GetReadClient(t *testing.T) { client: &mockClient, readClient: &mockReadClient, readReplicaReplicas: 1, - //nolint: govet,copylocks + //nolint:govet,copylocks //skipcq: VET-V0008 roundRobin: counter, }, @@ -98,7 +98,7 @@ func Test_client_GetReadClient(t *testing.T) { client: &mockClient, readClient: &mockReadClient, readReplicaReplicas: 3, - //nolint: govet,copylocks + //nolint:govet,copylocks //skipcq: VET-V0008 roundRobin: counter, }, @@ -106,10 +106,10 @@ func Test_client_GetReadClient(t *testing.T) { } }(), } - //nolint: govet,copylocks + //nolint:govet,copylocks //skipcq: VET-V0008 for _, tc := range tests { - //nolint: govet,copylocks + //nolint:govet,copylocks //skipcq: VET-V0008 test := tc t.Run(test.name, func(t *testing.T) { @@ -117,7 +117,7 @@ func Test_client_GetReadClient(t *testing.T) { client: test.fields.client, readClient: test.fields.readClient, readReplicaReplicas: test.fields.readReplicaReplicas, - //nolint: govet,copylocks + //nolint:govet,copylocks //skipcq: VET-V0008 roundRobin: test.fields.roundRobin, } diff --git a/internal/config/benchmark.go b/internal/config/benchmark.go index 26fbc27a93..e7e9acb4e4 100644 --- a/internal/config/benchmark.go +++ b/internal/config/benchmark.go @@ -46,7 +46,7 @@ type BenchmarkScenario struct { Jobs []*BenchmarkJob `json:"jobs,omitempty" yaml:"jobs"` } -// BenchmarkTarget defines the desired state of BenchmarkTarget +// BenchmarkTarget defines the desired state of BenchmarkTarget. type BenchmarkTarget struct { Host string `json:"host,omitempty"` Port int `json:"port,omitempty"` @@ -57,7 +57,7 @@ func (t *BenchmarkTarget) Bind() *BenchmarkTarget { return t } -// BenchmarkDataset defines the desired state of BenchmarkDateset +// BenchmarkDataset defines the desired state of BenchmarkDateset. type BenchmarkDataset struct { Name string `json:"name,omitempty"` Group string `json:"group,omitempty"` @@ -73,13 +73,13 @@ func (d *BenchmarkDataset) Bind() *BenchmarkDataset { return d } -// BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange +// BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange. type BenchmarkDatasetRange struct { Start int `json:"start,omitempty"` End int `json:"end,omitempty"` } -// BenchmarkJobRule defines the desired state of BenchmarkJobRule +// BenchmarkJobRule defines the desired state of BenchmarkJobRule. type BenchmarkJobRule struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` @@ -91,7 +91,7 @@ func (r *BenchmarkJobRule) Bind() *BenchmarkJobRule { return r } -// InsertConfig defines the desired state of insert config +// InsertConfig defines the desired state of insert config. type InsertConfig struct { SkipStrictExistCheck bool `json:"skip_strict_exist_check,omitempty"` Timestamp string `json:"timestamp,omitempty"` @@ -102,7 +102,7 @@ func (cfg *InsertConfig) Bind() *InsertConfig { return cfg } -// UpdateConfig defines the desired state of update config +// UpdateConfig defines the desired state of update config. type UpdateConfig struct { SkipStrictExistCheck bool `json:"skip_strict_exist_check,omitempty"` Timestamp string `json:"timestamp,omitempty"` @@ -114,7 +114,7 @@ func (cfg *UpdateConfig) Bind() *UpdateConfig { return cfg } -// UpsertConfig defines the desired state of upsert config +// UpsertConfig defines the desired state of upsert config. type UpsertConfig struct { SkipStrictExistCheck bool `json:"skip_strict_exist_check,omitempty"` Timestamp string `json:"timestamp,omitempty"` @@ -126,7 +126,7 @@ func (cfg *UpsertConfig) Bind() *UpsertConfig { return cfg } -// SearchConfig defines the desired state of search config +// SearchConfig defines the desired state of search config. type SearchConfig struct { Epsilon float32 `json:"epsilon,omitempty"` Radius float32 `json:"radius,omitempty"` @@ -143,7 +143,7 @@ func (cfg *SearchConfig) Bind() *SearchConfig { return cfg } -// RemoveConfig defines the desired state of remove config +// RemoveConfig defines the desired state of remove config. type RemoveConfig struct { SkipStrictExistCheck bool `json:"skip_strict_exist_check,omitempty"` Timestamp string `json:"timestamp,omitempty"` @@ -154,7 +154,7 @@ func (cfg *RemoveConfig) Bind() *RemoveConfig { return cfg } -// ObjectConfig defines the desired state of object config +// ObjectConfig defines the desired state of object config. type ObjectConfig struct { FilterConfig FilterConfig `json:"filter_config,omitempty" yaml:"filter_config"` } @@ -164,7 +164,7 @@ func (cfg *ObjectConfig) Bind() *ObjectConfig { return cfg } -// FilterTarget defines the desired state of filter target +// FilterTarget defines the desired state of filter target. type FilterTarget struct { Host string `json:"host,omitempty" yaml:"host"` Port int32 `json:"port,omitempty" yaml:"port"` @@ -175,7 +175,7 @@ func (cfg *FilterTarget) Bind() *FilterTarget { return cfg } -// FilterConfig defines the desired state of filter config +// FilterConfig defines the desired state of filter config. type FilterConfig struct { Targets []*FilterTarget `json:"target,omitempty" yaml:"target"` } diff --git a/internal/config/lb.go b/internal/config/lb.go index cfc2a6fb2a..ba16d70582 100644 --- a/internal/config/lb.go +++ b/internal/config/lb.go @@ -63,7 +63,7 @@ func (g *LB) Bind() *LB { return g } -// ReadReplicaClient represents a configuration of grpc client for read replica +// ReadReplicaClient represents a configuration of grpc client for read replica. type ReadReplicaClient struct { Duration string `json:"duration" yaml:"duration"` Client *GRPCClient `json:"client" yaml:"client"` diff --git a/internal/config/ngt.go b/internal/config/ngt.go index 59b30af3c2..01b8b31165 100644 --- a/internal/config/ngt.go +++ b/internal/config/ngt.go @@ -99,13 +99,13 @@ type NGT struct { IsReadReplica bool `json:"is_readreplica" yaml:"is_readreplica"` } -// KVSDB represent the ngt vector bidirectional kv store configuration +// KVSDB represent the ngt vector bidirectional kv store configuration. type KVSDB struct { // Concurrency represents kvsdb range loop processing concurrency Concurrency int `json:"concurrency,omitempty" yaml:"concurrency,omitempty"` } -// VQueue represent the ngt vector queue buffer size +// VQueue represent the ngt vector queue buffer size. type VQueue struct { // InsertBufferPoolSize represents insert time ordered slice buffer size InsertBufferPoolSize int `json:"insert_buffer_pool_size,omitempty" yaml:"insert_buffer_pool_size"` diff --git a/internal/db/storage/blob/cloudstorage/option.go b/internal/db/storage/blob/cloudstorage/option.go index 9d236e99e5..575265a41c 100644 --- a/internal/db/storage/blob/cloudstorage/option.go +++ b/internal/db/storage/blob/cloudstorage/option.go @@ -39,7 +39,7 @@ func WithURL(str string) Option { } } -// WithURLOpener returns Option that sets c.urlOpner +// WithURLOpener returns Option that sets c.urlOpner. func WithURLOpener(uo *gcsblob.URLOpener) Option { return func(c *client) error { if uo != nil { diff --git a/internal/errors/agent.go b/internal/errors/agent.go index 01d89ce9be..da16986ade 100644 --- a/internal/errors/agent.go +++ b/internal/errors/agent.go @@ -18,7 +18,7 @@ package errors var ( - // ErrCreateIndexingIsInProgress represents an error that the indexing is in progress but search request received + // ErrCreateIndexingIsInProgress represents an error that the indexing is in progress but search request received. ErrCreateIndexingIsInProgress = New("create indexing is in progress") // ErrCreateProperty represents a function to generate an error that the property creation failed. diff --git a/internal/file/file.go b/internal/file/file.go index 5dbb94cb06..2d27b6fd7d 100644 --- a/internal/file/file.go +++ b/internal/file/file.go @@ -359,13 +359,13 @@ func ReadFile(path string) (n []byte, err error) { return io.ReadAll(f) } -// Exists returns file existence +// Exists returns file existence. func Exists(path string) (e bool) { e, _, _ = ExistsWithDetail(path) return e } -// ExistsWithDetail returns file existence with detailed information +// ExistsWithDetail returns file existence with detailed information. func ExistsWithDetail(path string) (e bool, fi fs.FileInfo, err error) { if path == "" { return false, nil, fs.ErrInvalid @@ -383,7 +383,7 @@ func ExistsWithDetail(path string) (e bool, fi fs.FileInfo, err error) { return true, fi, nil } -// MkdirAll creates directory like mkdir -p +// MkdirAll creates directory like mkdir -p. func MkdirAll(path string, perm fs.FileMode) (err error) { var ( exist bool @@ -426,7 +426,7 @@ func MkdirAll(path string, perm fs.FileMode) (err error) { } // MkdirTemp create temporary directory from given base path -// if base path is nil temporary directory will create from Go's standard library +// if base path is nil temporary directory will create from Go's standard library. func MkdirTemp(baseDir string) (path string, err error) { if len(baseDir) == 0 { baseDir = os.TempDir() @@ -442,7 +442,7 @@ func MkdirTemp(baseDir string) (path string, err error) { } // CreateTemp create temporary file from given base path -// if base path is nil temporary directory will create from Go's standard library +// if base path is nil temporary directory will create from Go's standard library. func CreateTemp(baseDir string) (f *os.File, err error) { dir, err := MkdirTemp(baseDir) if err != nil { @@ -462,7 +462,7 @@ func CreateTemp(baseDir string) (f *os.File, err error) { return nil, errors.ErrFailedToCreateFile(err, path, nil) } -// ListInDir returns file list in directory +// ListInDir returns file list in directory. func ListInDir(path string) ([]string, error) { exists, fi, err := ExistsWithDetail(path) if !exists { diff --git a/internal/info/info.go b/internal/info/info.go index c436a6e19d..f8c820701d 100644 --- a/internal/info/info.go +++ b/internal/info/info.go @@ -71,11 +71,11 @@ type StackTrace struct { } var ( - // injected from build script + // injected from build script. // Version represent Vald version. Version = "v0.0.1" - // GitCommit represent the Vald GitCommit + // GitCommit represent the Vald GitCommit. GitCommit = "main" // BuildTime represent the Vald Build time. BuildTime = "" diff --git a/internal/k8s/service/service.go b/internal/k8s/service/service.go index 2502adc74b..f15b62d4dd 100644 --- a/internal/k8s/service/service.go +++ b/internal/k8s/service/service.go @@ -33,10 +33,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" ) -// SvcWatcher is a type alias of k8s.ResourceController for service resources +// SvcWatcher is a type alias of k8s.ResourceController for service resources. type SvcWatcher k8s.ResourceController -// Service represents a kubernetes service information +// Service represents a kubernetes service information. type Service struct { Name string ClusterIP string diff --git a/internal/k8s/vald/benchmark/api/v1/info.go b/internal/k8s/vald/benchmark/api/v1/info.go index d1a4cbf62d..880970d8f6 100644 --- a/internal/k8s/vald/benchmark/api/v1/info.go +++ b/internal/k8s/vald/benchmark/api/v1/info.go @@ -22,9 +22,9 @@ import ( ) var ( - // GroupVersion is group version used to register these objects + // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "vald.vdaas.org", Version: "v1"} - // SchemeBuilder is used to add go types to the GroupVersionKind scheme + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme diff --git a/internal/k8s/vald/benchmark/api/v1/job_types.go b/internal/k8s/vald/benchmark/api/v1/job_types.go index 9114fde0c1..8c82d48e37 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 { - //nolint: tagalign + //nolint:tagalign *config.GlobalConfig `json:",omitempty" yaml:""` ServerConfig *config.Servers `json:"server_config,omitempty" yaml:"server_config"` Target *BenchmarkTarget `json:"target,omitempty" yaml:"target"` @@ -54,16 +54,16 @@ const ( BenchmarkJobHealthy = BenchmarkJobStatus("Healthy") ) -// BenchmarkTarget defines the desired state of BenchmarkTarget +// BenchmarkTarget defines the desired state of BenchmarkTarget. type BenchmarkTarget config.BenchmarkTarget -// BenchmarkDataset defines the desired state of BenchmarkDateset +// BenchmarkDataset defines the desired state of BenchmarkDateset. type BenchmarkDataset config.BenchmarkDataset -// BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange +// BenchmarkDatasetRange defines the desired state of BenchmarkDatesetRange. type BenchmarkDatasetRange config.BenchmarkDatasetRange -// BenchmarkJobRule defines the desired state of BenchmarkJobRule +// BenchmarkJobRule defines the desired state of BenchmarkJobRule. type BenchmarkJobRule config.BenchmarkJobRule type ValdBenchmarkJob struct { diff --git a/internal/k8s/vald/benchmark/job/job.go b/internal/k8s/vald/benchmark/job/job.go index 104184c508..60538c5b56 100644 --- a/internal/k8s/vald/benchmark/job/job.go +++ b/internal/k8s/vald/benchmark/job/job.go @@ -38,9 +38,9 @@ import ( type BenchmarkJobWatcher k8s.ResourceController var ( - // GroupVersion is group version used to register these objects + // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "vald.vdaas.org", Version: "v1"} - // SchemeBuilder is used to add go types to the GroupVersionKind scheme + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme @@ -80,7 +80,6 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re bj := new(v1.ValdBenchmarkJobList) err = r.mgr.GetClient().List(ctx, bj, r.lopts...) - if err != nil { if r.onError != nil { r.onError(err) diff --git a/internal/log/format/format.go b/internal/log/format/format.go index d8f6090372..a2868a2bf6 100644 --- a/internal/log/format/format.go +++ b/internal/log/format/format.go @@ -24,7 +24,7 @@ const ( Unknown Format = iota RAW JSON - // LTSV + // LTSV. ) func (f Format) String() string { diff --git a/internal/log/logger/type.go b/internal/log/logger/type.go index 51736695d6..5decaa67c8 100644 --- a/internal/log/logger/type.go +++ b/internal/log/logger/type.go @@ -27,7 +27,7 @@ const ( NOP // ZEROLOG // LOGRUS - // KLOG + // KLOG. ) func (m Type) String() string { diff --git a/internal/net/control/control_unix.go b/internal/net/control/control_unix.go index 51403ea871..28ab6f2843 100644 --- a/internal/net/control/control_unix.go +++ b/internal/net/control/control_unix.go @@ -41,7 +41,7 @@ const ( TCP_DEFER_ACCEPT = unix.TCP_DEFER_ACCEPT TCP_KEEPINTVL = unix.TCP_KEEPINTVL TCP_KEEPIDLE = unix.TCP_KEEPIDLE - // from linux/include/uapi/linux/tcp.h + // from linux/include/uapi/linux/tcp.h. TCP_FASTOPEN = unix.TCP_FASTOPEN TCP_FASTOPEN_CONNECT = unix.TCP_FASTOPEN_CONNECT diff --git a/internal/net/dialer_test.go b/internal/net/dialer_test.go index 23f4962744..8700d73bac 100644 --- a/internal/net/dialer_test.go +++ b/internal/net/dialer_test.go @@ -265,13 +265,13 @@ func TestNewDialer(t *testing.T) { return errors.Errorf("got: \"%+v\" is not a dialer", gotDer) } // skipcq: VET-V0008 - //nolint: govet,copylocks + //nolint:govet,copylocks if diff := comparator.Diff(*want, *got, // skipcq: VET-V0008 - //nolint: govet,copylocks + //nolint:govet,copylocks comparator.IgnoreFields(*want, "dialer", "der", "addrs", "dnsCachedOnce", "dnsCache", "ctrl", "tmu"), // skipcq: VET-V0008 - //nolint: govet,copylocks + //nolint:govet,copylocks comparator.AllowUnexported(*want), comparator.Comparer(func(x, y cacher.Cache[*dialerCache]) bool { if x == nil && y == nil { diff --git a/internal/net/grpc/proto/proto.go b/internal/net/grpc/proto/proto.go index 981b2678cb..5115f8ed56 100644 --- a/internal/net/grpc/proto/proto.go +++ b/internal/net/grpc/proto/proto.go @@ -50,12 +50,12 @@ func Clone(m Message) Message { return proto.Clone(m) } -// ToMessageV1 downcasts Messages to V1 protobuf MessageV1 +// ToMessageV1 downcasts Messages to V1 protobuf MessageV1. func ToMessageV1(m Message) MessageV1 { return protoimpl.X.ProtoMessageV1Of(m) } -// ToMessageV2 upcasts V1 Message to V2 protobuf MessageV2 +// ToMessageV2 upcasts V1 Message to V2 protobuf MessageV2. func ToMessageV2(m MessageV1) Message { return protoimpl.X.ProtoMessageV2Of(m) } diff --git a/internal/net/http/transport/roundtrip_test.go b/internal/net/http/transport/roundtrip_test.go index 984b77a781..f295d50f64 100644 --- a/internal/net/http/transport/roundtrip_test.go +++ b/internal/net/http/transport/roundtrip_test.go @@ -409,7 +409,7 @@ func Test_ert_doRoundTrip(t *testing.T) { RoundTripFunc: func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusBadGateway, - Body: io.NopCloser(bytes.NewBuffer([]byte("abc"))), + Body: io.NopCloser(bytes.NewBufferString("abc")), }, nil }, }, @@ -448,7 +448,7 @@ func Test_ert_doRoundTrip(t *testing.T) { RoundTripFunc: func(*http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusBadGateway, - Body: io.NopCloser(bytes.NewBuffer([]byte("abc"))), + Body: io.NopCloser(bytes.NewBufferString("abc")), }, errors.New("dummy") }, }, diff --git a/internal/net/net.go b/internal/net/net.go index a14369afa5..9e45aeec35 100644 --- a/internal/net/net.go +++ b/internal/net/net.go @@ -188,7 +188,7 @@ func DialContext(ctx context.Context, network, addr string) (conn Conn, err erro return DefaultResolver.Dial(ctx, network, addr) } -// JoinHostPort joins the host/IP address and the port number, +// JoinHostPort joins the host/IP address and the port number,. func JoinHostPort(host string, port uint16) string { return net.JoinHostPort(host, strconv.FormatUint(uint64(port), 10)) } @@ -275,7 +275,7 @@ func ScanPorts(ctx context.Context, start, end uint16, host string) (ports []uin return ports, nil } -// LoadLocalIP returns local ip address +// LoadLocalIP returns local ip address. func LoadLocalIP() string { addrs, err := net.InterfaceAddrs() if err != nil { diff --git a/internal/observability/metrics/mem/mem.go b/internal/observability/metrics/mem/mem.go index e2479ffec7..ece3236388 100644 --- a/internal/observability/metrics/mem/mem.go +++ b/internal/observability/metrics/mem/mem.go @@ -29,7 +29,7 @@ import ( ) const ( - // metrics from runtime.Memstats + // metrics from runtime.Memstats. allocMetricsName = "alloc_bytes" allocMetricsDescription = "Currently allocated number of bytes on the heap" @@ -111,7 +111,7 @@ const ( liveObjectsMetricsName = "live_objects_count" liveObjectsMetricsDescription = "The cumulative count of living heap objects allocated. It contains the two following parts (liveObjects = mallocs - frees)" - // metrics from /proc//status + // metrics from /proc//status. vmpeakMetricsName = "vmpeak_bytes" vmpeakMetricsDescription = "peak virtual memory size" diff --git a/internal/sync/singleflight/singleflight_test.go b/internal/sync/singleflight/singleflight_test.go index 9eeec59192..021933f2b8 100644 --- a/internal/sync/singleflight/singleflight_test.go +++ b/internal/sync/singleflight/singleflight_test.go @@ -113,7 +113,7 @@ func Test_group_Do(t *testing.T) { // the unparam lint rule is disabled here because we need to match the interface to singleflight implementation. // if this rule is not disabled, if will warns that the error will always return null. - //nolint:unparam + fn1 := func(context.Context) (string, error) { atomic.AddUint32(&cnt1, 1) return "res_1", nil diff --git a/internal/test/data/hdf5/hdf5.go b/internal/test/data/hdf5/hdf5.go index 1dd21039d2..5275a57e10 100644 --- a/internal/test/data/hdf5/hdf5.go +++ b/internal/test/data/hdf5/hdf5.go @@ -172,7 +172,7 @@ func (d *data) GetPath() string { return d.path } -// TODO: Apply generics +// TODO: Apply generics. func (d *data) GetByGroupName(name string) [][]float32 { switch name { case "train": diff --git a/internal/test/data/vector/gen.go b/internal/test/data/vector/gen.go index a9a56c60db..31796f8866 100644 --- a/internal/test/data/vector/gen.go +++ b/internal/test/data/vector/gen.go @@ -41,7 +41,7 @@ const ( // ErrUnknownDistribution represents an error which the distribution is unknown. var ErrUnknownDistribution = errors.New("Unknown distribution generator type") -// Float32VectorGenerator returns float32 vector generator function which has selected distribution +// Float32VectorGenerator returns float32 vector generator function which has selected distribution. func Float32VectorGenerator(d Distribution) (Float32VectorGeneratorFunc, error) { switch d { case Gaussian: @@ -55,7 +55,7 @@ func Float32VectorGenerator(d Distribution) (Float32VectorGeneratorFunc, error) } } -// Uint8VectorGenerator returns uint8 vector generator function which has selected distribution +// Uint8VectorGenerator returns uint8 vector generator function which has selected distribution. func Uint8VectorGenerator(d Distribution) (Uint8VectorGeneratorFunc, error) { switch d { case Gaussian: @@ -81,12 +81,12 @@ func genF32Slice(n, dim int, gen func() float32) (ret [][]float32) { return } -// UniformDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Uniform distribution +// UniformDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Uniform distribution. func UniformDistributedFloat32VectorGenerator(n, dim int) [][]float32 { return genF32Slice(n, dim, rand.Float32) } -// NegativeUniformDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Uniform distribution +// NegativeUniformDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Uniform distribution. func NegativeUniformDistributedFloat32VectorGenerator(n, dim int) (vecs [][]float32) { left, right := dim/2, dim-dim/2 lvs := genF32Slice(n, left, func() float32 { @@ -105,14 +105,14 @@ func NegativeUniformDistributedFloat32VectorGenerator(n, dim int) (vecs [][]floa return vecs } -// GaussianDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Gaussian distribution +// GaussianDistributedFloat32VectorGenerator returns n float32 vectors with dim dimension and their values under Gaussian distribution. func GaussianDistributedFloat32VectorGenerator(n, dim int) [][]float32 { return genF32Slice(n, dim, func() float32 { return float32(rand.NormFloat64()) }) } -// genUint8Slice return n uint8 vectors with dim dimension +// genUint8Slice return n uint8 vectors with dim dimension. func genUint8Slice(n, dim int, gen func() uint8) (ret [][]uint8) { ret = make([][]uint8, 0, n) @@ -126,14 +126,14 @@ func genUint8Slice(n, dim int, gen func() uint8) (ret [][]uint8) { return } -// UniformDistributedUint8VectorGenerator returns n uint8 vectors with dim dimension and their values under Uniform distribution +// UniformDistributedUint8VectorGenerator returns n uint8 vectors with dim dimension and their values under Uniform distribution. func UniformDistributedUint8VectorGenerator(n, dim int) [][]uint8 { return genUint8Slice(n, dim, func() uint8 { return uint8(irand.LimitedUint32(math.MaxUint8)) }) } -// GaussianDistributedUint8VectorGenerator returns n uint8 vectors with dim dimension and their values under Gaussian distribution +// GaussianDistributedUint8VectorGenerator returns n uint8 vectors with dim dimension and their values under Gaussian distribution. func GaussianDistributedUint8VectorGenerator(n, dim int) [][]uint8 { // NOTE: The boundary test is the main purpose for refactoring. Now, passing this function is dependent on the seed of the random generator. We should fix the randomness of the passing test. return genUint8Slice(n, dim, func() uint8 { @@ -175,7 +175,7 @@ func GenSameValueVec(size int, val float32) []float32 { return v } -// ConvertVectorsUint8ToFloat32 converts uint8 vectors and return float32 vectors +// ConvertVectorsUint8ToFloat32 converts uint8 vectors and return float32 vectors. func ConvertVectorsUint8ToFloat32(vectors [][]uint8) (ret [][]float32) { ret = make([][]float32, 0, len(vectors)) for _, vec := range vectors { diff --git a/internal/test/mock/grpc_testify_mock.go b/internal/test/mock/grpc_testify_mock.go index 0777cb0c20..858a5819a4 100644 --- a/internal/test/mock/grpc_testify_mock.go +++ b/internal/test/mock/grpc_testify_mock.go @@ -58,7 +58,7 @@ func (*ServerStreamTestifyMock) RecvMsg(_ interface{}) error { return nil } -// ListObjectStreamMock is a testify mock struct for ListObjectStream based on ServerStreamTestifyMock +// ListObjectStreamMock is a testify mock struct for ListObjectStream based on ServerStreamTestifyMock. type ListObjectStreamMock struct { ServerStreamTestifyMock } diff --git a/pkg/agent/core/ngt/config/config_test.go b/pkg/agent/core/ngt/config/config_test.go index 1379dff5b1..4878159ee1 100644 --- a/pkg/agent/core/ngt/config/config_test.go +++ b/pkg/agent/core/ngt/config/config_test.go @@ -85,7 +85,7 @@ func TestNewConfig(t *testing.T) { if err != nil { t.Fatal(err) } - if _, err := f.Write([]byte(data)); err != nil { + if _, err := f.WriteString(data); err != nil { t.Fatal(err) } if err := f.Close(); err != nil { @@ -150,7 +150,7 @@ func TestNewConfig(t *testing.T) { if err != nil { t.Fatal(err) } - if _, err := f.Write([]byte(data)); err != nil { + if _, err := f.WriteString(data); err != nil { t.Fatal(err) } if err := f.Close(); err != nil { @@ -208,7 +208,7 @@ func TestNewConfig(t *testing.T) { if err != nil { t.Fatal(err) } - if _, err := f.Write([]byte(data)); err != nil { + if _, err := f.WriteString(data); err != nil { t.Fatal(err) } if err := f.Close(); err != nil { @@ -271,7 +271,7 @@ func TestNewConfig(t *testing.T) { if err != nil { t.Fatal(err) } - if _, err := f.Write([]byte(data)); err != nil { + if _, err := f.WriteString(data); err != nil { t.Fatal(err) } if err := f.Close(); err != nil { diff --git a/pkg/agent/core/ngt/service/option.go b/pkg/agent/core/ngt/service/option.go index 301c66c621..b567f92ccc 100644 --- a/pkg/agent/core/ngt/service/option.go +++ b/pkg/agent/core/ngt/service/option.go @@ -30,7 +30,7 @@ import ( "github.com/vdaas/vald/internal/timeutil" ) -// Option represent the functional option for ngt +// Option represent the functional option for ngt. type Option func(n *ngt) error var defaultOptions = []Option{ diff --git a/pkg/agent/internal/vqueue/queue.go b/pkg/agent/internal/vqueue/queue.go index b89769c2f9..ce3fd8552f 100644 --- a/pkg/agent/internal/vqueue/queue.go +++ b/pkg/agent/internal/vqueue/queue.go @@ -30,7 +30,7 @@ import ( "github.com/vdaas/vald/internal/sync" ) -// Queue represents vector queue cache interface +// Queue represents vector queue cache interface. type Queue interface { PushInsert(uuid string, vector []float32, date int64) error PushDelete(uuid string, date int64) error diff --git a/pkg/gateway/lb/handler/grpc/aggregation.go b/pkg/gateway/lb/handler/grpc/aggregation.go index 99f9d45fcc..81423c6bd2 100644 --- a/pkg/gateway/lb/handler/grpc/aggregation.go +++ b/pkg/gateway/lb/handler/grpc/aggregation.go @@ -353,7 +353,7 @@ func (s *server) aggregationSearch(ctx context.Context, aggr Aggregator, cfg *pa return res, nil } -// vald standard algorithm +// vald standard algorithm. type valdStdAggr struct { num int wg sync.WaitGroup @@ -485,7 +485,7 @@ func (v *valdStdAggr) Result() *payload.Search_Response { } } -// pairing heap +// pairing heap. type valdPairingHeapAggr struct { num int ph *PairingHeap @@ -544,7 +544,7 @@ func (v *valdPairingHeapAggr) Result() *payload.Search_Response { } } -// plane sort +// plane sort. type valdSliceAggr struct { num int mu sync.Mutex @@ -597,7 +597,7 @@ func (v *valdSliceAggr) Result() (res *payload.Search_Response) { return res } -// plane sort +// plane sort. type valdPoolSliceAggr struct { num int mu sync.Mutex diff --git a/pkg/index/job/correction/service/corrector.go b/pkg/index/job/correction/service/corrector.go index d16eb8ef85..0ea917a8fb 100644 --- a/pkg/index/job/correction/service/corrector.go +++ b/pkg/index/job/correction/service/corrector.go @@ -305,7 +305,7 @@ type vectorReplica struct { vec *payload.Object_Vector } -// Validate len(addrs) >= 2 before calling this function +// Validate len(addrs) >= 2 before calling this function. func (c *correct) checkConsistency(ctx context.Context, targetReplica *vectorReplica, targetAgentIdx int) error { // leftAgentAddrs is the agents' addr that hasn't been corrected yet. leftAgentAddrs := c.sortedByIndexCntAddrs[targetAgentIdx+1:] diff --git a/pkg/index/job/correction/service/options.go b/pkg/index/job/correction/service/options.go index 3913271e6b..f8350eef97 100644 --- a/pkg/index/job/correction/service/options.go +++ b/pkg/index/job/correction/service/options.go @@ -22,8 +22,10 @@ import ( type Option func(*correct) error var defaultOpts = []Option{ - WithStreamListConcurrency(200), //nolint:gomnd - WithKvsAsyncWriteConcurrency(2048), //nolint:gomnd + //nolint:gomnd + WithStreamListConcurrency(200), + //nolint:gomnd + WithKvsAsyncWriteConcurrency(2048), } // WithIndexReplica returns Option that sets index replica. diff --git a/pkg/tools/benchmark/job/config/config.go b/pkg/tools/benchmark/job/config/config.go index 25d734bf13..adec58d118 100644 --- a/pkg/tools/benchmark/job/config/config.go +++ b/pkg/tools/benchmark/job/config/config.go @@ -28,7 +28,7 @@ import ( "github.com/vdaas/vald/internal/log" ) -// GlobalConfig is type alias for config.GlobalConfig +// GlobalConfig is type alias for config.GlobalConfig. type GlobalConfig = config.GlobalConfig // Config represent a application setting data content (config.yaml). diff --git a/pkg/tools/benchmark/job/router/router.go b/pkg/tools/benchmark/job/router/router.go index 07356c8ff2..4704515b8a 100644 --- a/pkg/tools/benchmark/job/router/router.go +++ b/pkg/tools/benchmark/job/router/router.go @@ -32,7 +32,7 @@ type router struct { timeout string } -// New returns REST route&method information from handler interface +// New returns REST route&method information from handler interface. func New(opts ...Option) http.Handler { r := new(router) diff --git a/pkg/tools/benchmark/job/service/job.go b/pkg/tools/benchmark/job/service/job.go index 9f066d8b73..455d6f1794 100644 --- a/pkg/tools/benchmark/job/service/job.go +++ b/pkg/tools/benchmark/job/service/job.go @@ -321,7 +321,7 @@ func calcRecall(linearRes, searchRes *payload.Search_Response) (recall float64) return recall / float64(len(lres)) } -// TODO: apply many object type +// TODO: apply many object type. func addNoiseToVec(oVec []float32) []float32 { noise := rand.Float32() vec := oVec diff --git a/pkg/tools/benchmark/operator/config/config.go b/pkg/tools/benchmark/operator/config/config.go index 9bd44965b7..0fe9dadea0 100644 --- a/pkg/tools/benchmark/operator/config/config.go +++ b/pkg/tools/benchmark/operator/config/config.go @@ -21,7 +21,7 @@ import ( "github.com/vdaas/vald/internal/config" ) -// GlobalConfig is type alias for config.GlobalConfig +// GlobalConfig is type alias for config.GlobalConfig. type GlobalConfig = config.GlobalConfig // Config represent a application setting data content (config.yaml). diff --git a/pkg/tools/benchmark/operator/router/router.go b/pkg/tools/benchmark/operator/router/router.go index 64514c9c35..fcf7b8b518 100644 --- a/pkg/tools/benchmark/operator/router/router.go +++ b/pkg/tools/benchmark/operator/router/router.go @@ -32,7 +32,7 @@ type router struct { timeout string } -// New returns REST route&method information from handler interface +// New returns REST route&method information from handler interface. func New(opts ...Option) http.Handler { r := new(router) diff --git a/pkg/tools/benchmark/operator/service/operator.go b/pkg/tools/benchmark/operator/service/operator.go index 89a6a67b28..9ddf86a82a 100644 --- a/pkg/tools/benchmark/operator/service/operator.go +++ b/pkg/tools/benchmark/operator/service/operator.go @@ -498,7 +498,7 @@ func (o *operator) createJob(ctx context.Context, bjr v1.ValdBenchmarkJob) error return nil } -// updateBenchmarkScenarioStatus updates status of ValdBenchmarkScenarioResource +// updateBenchmarkScenarioStatus updates status of ValdBenchmarkScenarioResource. func (o *operator) updateBenchmarkScenarioStatus(ctx context.Context, ss map[string]v1.ValdBenchmarkScenarioStatus) ([]string, error) { var sns []string if cbsl := o.getAtomicScenario(); cbsl != nil { @@ -521,7 +521,7 @@ func (o *operator) updateBenchmarkScenarioStatus(ctx context.Context, ss map[str return sns, nil } -// updateBenchmarkJobStatus updates status of ValdBenchmarkJobResource +// updateBenchmarkJobStatus updates status of ValdBenchmarkJobResource. func (o *operator) updateBenchmarkJobStatus(ctx context.Context, js map[string]v1.BenchmarkJobStatus) ([]string, error) { var jns []string if cbjl := o.getAtomicBenchJob(); cbjl != nil { diff --git a/pkg/tools/cli/loadtest/config/config.go b/pkg/tools/cli/loadtest/config/config.go index dd73b5308d..f9c82973df 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 { - //nolint: tagalign + //nolint:tagalign config.GlobalConfig `json:",inline" yaml:",inline"` Addr string `json:"addr" yaml:"addr"` Operation string `json:"operation" yaml:"operation"` diff --git a/tests/performance/max_vector_dim_test.go b/tests/performance/max_vector_dim_test.go index 75a81c7feb..1eb434ce49 100644 --- a/tests/performance/max_vector_dim_test.go +++ b/tests/performance/max_vector_dim_test.go @@ -90,7 +90,7 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } -// Test for investigation of max dimension size for agent handler +// Test for investigation of max dimension size for agent handler. func TestMaxDimInsert(t *testing.T) { t.Helper() eg, ctx := errgroup.New(context.Background()) @@ -192,7 +192,7 @@ func TestMaxDimInsert(t *testing.T) { t.Logf("Max bit is %d", max_bit) } -// Test for investigation of max dimension size for agent handler with gRPC +// Test for investigation of max dimension size for agent handler with gRPC. func TestMaxDimInsertGRPC(t *testing.T) { // MaxUint64 cannot be used due to overflows t.Helper()