diff --git a/.golangci.yml b/.golangci.yml index 645ad885e3..ff07ed391b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,7 +29,7 @@ linters-settings: godot: capital: true - period: false + period: true scope: toplevel exclude: - go-sumtype:decl diff --git a/admin/cli/cli.go b/admin/cli/cli.go index 36e5d4615f..8b5def5d9a 100644 --- a/admin/cli/cli.go +++ b/admin/cli/cli.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package cli stores cli configuration and common logic for commands +// Package cli stores cli configuration and common logic for commands. package cli import ( diff --git a/admin/cli/flags/global.go b/admin/cli/flags/global.go index 8714d8023a..9a2e42f71b 100644 --- a/admin/cli/flags/global.go +++ b/admin/cli/flags/global.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package flags holds global flags +// Package flags holds global flags. package flags import ( diff --git a/admin/cmd/bootstrap.go b/admin/cmd/bootstrap.go index 369a3a3fa4..44b96b0fe0 100644 --- a/admin/cmd/bootstrap.go +++ b/admin/cmd/bootstrap.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package cmd holds common logic used by commands +// Package cmd holds common logic used by commands. package cmd import ( diff --git a/admin/commands/base/setup.go b/admin/commands/base/setup.go index be6b76fd89..35d35b82d4 100644 --- a/admin/commands/base/setup.go +++ b/admin/commands/base/setup.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package base provides helpers for all commands +// Package base provides helpers for all commands. package base import ( diff --git a/admin/commands/pmm/client/base.go b/admin/commands/pmm/client/base.go index 05e4f3f511..24da73a78d 100644 --- a/admin/commands/pmm/client/base.go +++ b/admin/commands/pmm/client/base.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package client holds the "pmm client" command +// Package client holds the "pmm client" command. package client import "github.com/percona/pmm/admin/commands" diff --git a/admin/commands/pmm/server/base.go b/admin/commands/pmm/server/base.go index 600f4e8233..795be8f5f8 100644 --- a/admin/commands/pmm/server/base.go +++ b/admin/commands/pmm/server/base.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package server holds the "pmm server" command +// Package server holds the "pmm server" command. package server import ( diff --git a/admin/commands/pmm/server/docker/base.go b/admin/commands/pmm/server/docker/base.go index 643fae3d71..b3e67bf930 100644 --- a/admin/commands/pmm/server/docker/base.go +++ b/admin/commands/pmm/server/docker/base.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package docker holds the "pmm server install docker" command +// Package docker holds the "pmm server install docker" command. package docker import ( diff --git a/admin/commands/pmm/server/docker/base_test.go b/admin/commands/pmm/server/docker/base_test.go index a3c778e47f..90a366f53e 100644 --- a/admin/commands/pmm/server/docker/base_test.go +++ b/admin/commands/pmm/server/docker/base_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package docker holds the "pmm server install docker" command +// Package docker holds the "pmm server install docker" command. package docker import ( diff --git a/admin/commands/summary.go b/admin/commands/summary.go index 694c1ac287..998f177d13 100644 --- a/admin/commands/summary.go +++ b/admin/commands/summary.go @@ -254,7 +254,7 @@ func getURL(ctx context.Context, url string) ([]byte, error) { return b, nil } -// downloadFile download file and includes into zip file +// downloadFile download file and includes into zip file. func downloadFile(ctx context.Context, zipW *zip.Writer, url, fileName string) error { b, err := getURL(ctx, url) if err != nil { diff --git a/admin/pkg/bubbles/progress/size.go b/admin/pkg/bubbles/progress/size.go index ed95e48265..2dc15d05d5 100644 --- a/admin/pkg/bubbles/progress/size.go +++ b/admin/pkg/bubbles/progress/size.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package progress contains progress bar programs to be rendered with BubbleTea +// Package progress contains progress bar programs to be rendered with BubbleTea. package progress import ( diff --git a/admin/pkg/bubbles/styles/styles.go b/admin/pkg/bubbles/styles/styles.go index 8f5c987f4e..fad7bfdf87 100644 --- a/admin/pkg/bubbles/styles/styles.go +++ b/admin/pkg/bubbles/styles/styles.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package styles holds common styles for BubbleTea programs +// Package styles holds common styles for BubbleTea programs. package styles import "github.com/charmbracelet/lipgloss" diff --git a/admin/pkg/client/client.go b/admin/pkg/client/client.go index eaa0132d13..cc57ffa3e7 100644 --- a/admin/pkg/client/client.go +++ b/admin/pkg/client/client.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package client provides common methods for working with pmm-client +// Package client provides common methods for working with pmm-client. package client import ( diff --git a/admin/pkg/client/tarball/tarball.go b/admin/pkg/client/tarball/tarball.go index a6dd297a4c..39ce808ff5 100644 --- a/admin/pkg/client/tarball/tarball.go +++ b/admin/pkg/client/tarball/tarball.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package tarball holds logic for pmm-client tarball specific operations +// Package tarball holds logic for pmm-client tarball specific operations. package tarball import ( diff --git a/admin/pkg/common/common.go b/admin/pkg/common/common.go index de6c1340fa..e9611c1474 100644 --- a/admin/pkg/common/common.go +++ b/admin/pkg/common/common.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package common holds common methods used in admin +// Package common holds common methods used in admin. package common import ( diff --git a/admin/pkg/docker/docker.go b/admin/pkg/docker/docker.go index 75921ef2a9..04d7fdb7ac 100644 --- a/admin/pkg/docker/docker.go +++ b/admin/pkg/docker/docker.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package docker stores common functions for working with Docker +// Package docker stores common functions for working with Docker. package docker import ( diff --git a/agent/agentlocal/agent_local.go b/agent/agentlocal/agent_local.go index d5a3c6e9c3..60a6e3325f 100644 --- a/agent/agentlocal/agent_local.go +++ b/agent/agentlocal/agent_local.go @@ -349,7 +349,7 @@ var ( _ agentlocalpb.AgentLocalServer = (*Server)(nil) ) -// addData add data to zip file +// addData add data to zip file. func addData(zipW *zip.Writer, name string, data []byte) error { f, err := zipW.Create(name) if err != nil { diff --git a/agent/agents/cache/cache.go b/agent/agents/cache/cache.go index 41c506981f..f7aba164a5 100644 --- a/agent/agents/cache/cache.go +++ b/agent/agents/cache/cache.go @@ -47,7 +47,7 @@ type Cache struct { trimmedN uint } -// cacheItem is an element stored in Cache +// cacheItem is an element stored in Cache. type cacheItem struct { key interface{} value interface{} diff --git a/agent/agents/mongodb/mongodb.go b/agent/agents/mongodb/mongodb.go index 0c98a8e75e..6f34fc74be 100644 --- a/agent/agents/mongodb/mongodb.go +++ b/agent/agents/mongodb/mongodb.go @@ -119,7 +119,7 @@ func (m *MongoDB) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*MongoDB)(nil) ) diff --git a/agent/agents/mysql/perfschema/history.go b/agent/agents/mysql/perfschema/history.go index 7fc3c30a20..5f35ec9a2b 100644 --- a/agent/agents/mysql/perfschema/history.go +++ b/agent/agents/mysql/perfschema/history.go @@ -25,7 +25,7 @@ import ( "github.com/percona/pmm/agent/agents/cache" ) -// historyCache is a wrapper for cache.Cache to use only with historyMap type +// historyCache is a wrapper for cache.Cache to use only with historyMap type. type historyCache struct { cache *cache.Cache } diff --git a/agent/agents/mysql/perfschema/perfschema.go b/agent/agents/mysql/perfschema/perfschema.go index 949d277e08..9dc5500dbe 100644 --- a/agent/agents/mysql/perfschema/perfschema.go +++ b/agent/agents/mysql/perfschema/perfschema.go @@ -47,7 +47,7 @@ type ( summaryMap map[string]*eventsStatementsSummaryByDigest ) -// mySQLVersion contains +// mySQLVersion contains. type mySQLVersion struct { version float64 vendor string @@ -107,7 +107,7 @@ type Params struct { TLSSkipVerify bool } -// newPerfSchemaParams holds all required parameters to instantiate a new PerfSchema +// newPerfSchemaParams holds all required parameters to instantiate a new PerfSchema. type newPerfSchemaParams struct { Querier *reform.Querier DBCloser io.Closer @@ -520,7 +520,7 @@ func (m *PerfSchema) Collect(ch chan<- prometheus.Metric) { } } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*PerfSchema)(nil) ) diff --git a/agent/agents/mysql/perfschema/summaries.go b/agent/agents/mysql/perfschema/summaries.go index b0f8a06e48..ffd7afd9aa 100644 --- a/agent/agents/mysql/perfschema/summaries.go +++ b/agent/agents/mysql/perfschema/summaries.go @@ -25,7 +25,7 @@ import ( "github.com/percona/pmm/agent/agents/cache" ) -// summaryCache is a wrapper for cache.Cache to use only with summaryMap type +// summaryCache is a wrapper for cache.Cache to use only with summaryMap type. type summaryCache struct { cache *cache.Cache } diff --git a/agent/agents/mysql/slowlog/parser/continuous_file_reader.go b/agent/agents/mysql/slowlog/parser/continuous_file_reader.go index f49b1be406..7904d08739 100644 --- a/agent/agents/mysql/slowlog/parser/continuous_file_reader.go +++ b/agent/agents/mysql/slowlog/parser/continuous_file_reader.go @@ -182,7 +182,7 @@ func (r *ContinuousFileReader) Metrics() *ReaderMetrics { return &m } -// check interfaces +// check interfaces. var ( _ Reader = (*ContinuousFileReader)(nil) ) diff --git a/agent/agents/mysql/slowlog/parser/logger_test.go b/agent/agents/mysql/slowlog/parser/logger_test.go index 98df8c5dd2..49fbf171f9 100644 --- a/agent/agents/mysql/slowlog/parser/logger_test.go +++ b/agent/agents/mysql/slowlog/parser/logger_test.go @@ -40,5 +40,5 @@ func (tl *testLogger) Tracef(format string, v ...interface{}) { tl.t.Logf("TRACE: "+format, v...) } -// check interface +// check interface. var _ Logger = (*testLogger)(nil) diff --git a/agent/agents/mysql/slowlog/parser/simple_file_reader.go b/agent/agents/mysql/slowlog/parser/simple_file_reader.go index 25a360399a..38f6ab0919 100644 --- a/agent/agents/mysql/slowlog/parser/simple_file_reader.go +++ b/agent/agents/mysql/slowlog/parser/simple_file_reader.go @@ -76,7 +76,7 @@ func (r *SimpleFileReader) Metrics() *ReaderMetrics { return &m } -// check interfaces +// check interfaces. var ( _ Reader = (*SimpleFileReader)(nil) ) diff --git a/agent/agents/mysql/slowlog/slowlog.go b/agent/agents/mysql/slowlog/slowlog.go index 2c7f359031..05081a68f9 100644 --- a/agent/agents/mysql/slowlog/slowlog.go +++ b/agent/agents/mysql/slowlog/slowlog.go @@ -724,7 +724,7 @@ func (s *SlowLog) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*SlowLog)(nil) ) diff --git a/agent/agents/noop/noop.go b/agent/agents/noop/noop.go index 8578cfce01..3941eb5aed 100644 --- a/agent/agents/noop/noop.go +++ b/agent/agents/noop/noop.go @@ -66,7 +66,7 @@ func (n *NoOp) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*NoOp)(nil) ) diff --git a/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go b/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go index b5d4b80485..22f84a0f74 100644 --- a/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go +++ b/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go @@ -724,5 +724,5 @@ func (m *PGStatMonitorQAN) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var _ prometheus.Collector = (*PGStatMonitorQAN)(nil) diff --git a/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go b/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go index a3f865d70f..bd67c58502 100644 --- a/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go +++ b/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go @@ -34,7 +34,7 @@ var ( v08 = version.Must(version.NewVersion("0.8")) ) -// pgStatMonitor represents a row in pg_stat_monitor view +// pgStatMonitor represents a row in pg_stat_monitor view. type pgStatMonitor struct { // PGSM < 0.6.0 DBID int64 @@ -348,7 +348,7 @@ func (s *pgStatMonitor) View() reform.View { //nolint:ireturn } var ( - // Check interfaces + // Check interfaces. _ reform.Struct = (*pgStatMonitor)(nil) _ fmt.Stringer = (*pgStatMonitor)(nil) ) diff --git a/agent/agents/postgres/pgstatstatements/pgstatstatements.go b/agent/agents/postgres/pgstatstatements/pgstatstatements.go index 2a86d4e8a4..d880eebab8 100644 --- a/agent/agents/postgres/pgstatstatements/pgstatstatements.go +++ b/agent/agents/postgres/pgstatstatements/pgstatstatements.go @@ -423,7 +423,7 @@ func (m *PGStatStatementsQAN) Collect(ch chan<- prometheus.Metric) { } } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*PGStatStatementsQAN)(nil) ) diff --git a/agent/agents/postgres/pgstatstatements/utils.go b/agent/agents/postgres/pgstatstatements/utils.go index d1c62f5414..71c59b5a06 100644 --- a/agent/agents/postgres/pgstatstatements/utils.go +++ b/agent/agents/postgres/pgstatstatements/utils.go @@ -26,7 +26,7 @@ import ( "github.com/percona/pmm/agent/utils/truncate" ) -// statementsCache is a wrapper for cache.Cache to use only with statementsMap type +// statementsCache is a wrapper for cache.Cache to use only with statementsMap type. type statementsCache struct { cache *cache.Cache } diff --git a/agent/agents/process/process.go b/agent/agents/process/process.go index 7e81a6bc7a..3d47680094 100644 --- a/agent/agents/process/process.go +++ b/agent/agents/process/process.go @@ -106,8 +106,8 @@ func (p *Process) Run(ctx context.Context) { close(p.ctxDone) } -// STARTING -> RUNNING -// STARTING -> WAITING +// STARTING -> RUNNING. +// STARTING -> WAITING. func (p *Process) toStarting() { p.l.Tracef("Process: starting.") p.changes <- inventorypb.AgentStatus_STARTING @@ -149,8 +149,8 @@ func (p *Process) toStarting() { } } -// RUNNING -> STOPPING -// RUNNING -> WAITING +// RUNNING -> STOPPING. +// RUNNING -> WAITING. func (p *Process) toRunning() { p.l.Tracef("Process: running.") p.changes <- inventorypb.AgentStatus_RUNNING @@ -166,8 +166,8 @@ func (p *Process) toRunning() { } } -// WAITING -> STARTING -// WAITING -> DONE +// WAITING -> STARTING. +// WAITING -> DONE. func (p *Process) toWaiting() { delay := p.backoff.Delay() @@ -192,7 +192,7 @@ func (p *Process) toWaiting() { } } -// STOPPING -> DONE +// STOPPING -> DONE. func (p *Process) toStopping() { p.l.Tracef("Process: stopping (sending SIGTERM)...") p.changes <- inventorypb.AgentStatus_STOPPING @@ -235,7 +235,7 @@ func (p *Process) Logs() []string { return p.pl.Latest() } -// check interfaces +// check interfaces. var ( _ fmt.Stringer = (*Params)(nil) ) diff --git a/agent/agents/process/process_logger.go b/agent/agents/process/process_logger.go index 319bdf2ad5..048990c1d3 100644 --- a/agent/agents/process/process_logger.go +++ b/agent/agents/process/process_logger.go @@ -148,7 +148,7 @@ func extractLogLevel(line string) (logrus.Level, bool, error) { return level, true, nil } -// check interfaces +// check interfaces. var ( _ io.Writer = (*processLogger)(nil) ) diff --git a/agent/agents/supervisor/supervisor.go b/agent/agents/supervisor/supervisor.go index f33595efa6..2a481b9238 100644 --- a/agent/agents/supervisor/supervisor.go +++ b/agent/agents/supervisor/supervisor.go @@ -112,7 +112,7 @@ func NewSupervisor(ctx context.Context, av agentVersioner, cfg configGetter) *Su } } -// Run waits for context and stop all agents when it's done +// Run waits for context and stop all agents when it's done. func (s *Supervisor) Run(ctx context.Context) { <-ctx.Done() s.stopAll() //nolint:contextcheck @@ -188,7 +188,7 @@ func (s *Supervisor) AgentLogByID(id string) ([]string, uint) { return nil, 0 } -// ClearChangesChannel drains state change channel +// ClearChangesChannel drains state change channel. func (s *Supervisor) ClearChangesChannel() { for { select { @@ -618,7 +618,7 @@ func (s *Supervisor) startBuiltin(agentID string, builtinAgent *agentpb.SetState return nil } -// agentLogger write logs to Store so can get last N +// agentLogger write logs to Store so can get last N. func (s *Supervisor) agentLogger(logStore *tailog.Store) *logrus.Logger { return &logrus.Logger{ Out: io.MultiWriter(os.Stderr, logStore), @@ -768,7 +768,7 @@ func (s *Supervisor) Collect(ch chan<- prometheus.Metric) { } } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*Supervisor)(nil) ) diff --git a/agent/client/basic_auth.go b/agent/client/basic_auth.go index f525c8d723..ae38d59a5b 100644 --- a/agent/client/basic_auth.go +++ b/agent/client/basic_auth.go @@ -40,7 +40,7 @@ func (*basicAuth) RequireTransportSecurity() bool { return false } -// check interfaces +// check interfaces. var ( _ credentials.PerRPCCredentials = (*basicAuth)(nil) ) diff --git a/agent/client/channel/channel.go b/agent/client/channel/channel.go index a7313ea584..ce272b2e35 100644 --- a/agent/client/channel/channel.go +++ b/agent/client/channel/channel.go @@ -207,7 +207,7 @@ func (c *Channel) send(msg *agentpb.AgentMessage) { c.mSend.Inc() } -// runReader receives messages from server +// runReader receives messages from server. func (c *Channel) runReceiver() { defer func() { close(c.requests) @@ -384,7 +384,7 @@ func (c *Channel) Collect(ch chan<- prometheus.Metric) { c.mSend.Collect(ch) } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*Channel)(nil) ) diff --git a/agent/client/client.go b/agent/client/client.go index e4e3b6c5ed..c2106072d0 100644 --- a/agent/client/client.go +++ b/agent/client/client.go @@ -232,7 +232,7 @@ func (c *Client) Run(ctx context.Context) error { return nil } -// SendActualStatuses sends status of running agents to server +// SendActualStatuses sends status of running agents to server. func (c *Client) SendActualStatuses() { for _, agent := range c.supervisor.AgentsList() { c.l.Infof("Sending status: %s (port %d).", agent.Status, agent.ListenPort) @@ -878,7 +878,7 @@ func (c *Client) GetServerConnectMetadata() *agentpb.ServerConnectMetadata { return md } -// GetConnectionUpTime returns connection uptime between agent and server in percentage (from 0 to 100) +// GetConnectionUpTime returns connection uptime between agent and server in percentage (from 0 to 100). func (c *Client) GetConnectionUpTime() float32 { return c.cus.GetConnectedUpTimeUntil(time.Now()) } @@ -906,7 +906,7 @@ func (c *Client) Collect(ch chan<- prometheus.Metric) { c.supervisor.Collect(ch) } -// argListFromPgParams creates an array of strings from the pointer to the parameters for pt-pg-sumamry +// argListFromPgParams creates an array of strings from the pointer to the parameters for pt-pg-sumamry. func argListFromPgParams(pParams *agentpb.StartActionRequest_PTPgSummaryParams) []string { var args []string @@ -930,7 +930,7 @@ func argListFromPgParams(pParams *agentpb.StartActionRequest_PTPgSummaryParams) return args } -// argListFromMongoDBParams creates an array of strings from the pointer to the parameters for pt-mongodb-sumamry +// argListFromMongoDBParams creates an array of strings from the pointer to the parameters for pt-mongodb-sumamry. func argListFromMongoDBParams(pParams *agentpb.StartActionRequest_PTMongoDBSummaryParams) []string { var args []string @@ -972,7 +972,7 @@ func convertAgentErrorToGrpcStatus(agentErr error) *grpcstatus.Status { return status } -// check interface +// check interface. var ( _ prometheus.Collector = (*Client)(nil) ) diff --git a/agent/commands/clients.go b/agent/commands/clients.go index 32641052aa..fd45ebcb7e 100644 --- a/agent/commands/clients.go +++ b/agent/commands/clients.go @@ -206,7 +206,7 @@ func serverRegister(cfgSetup *config.Setup) (agentID, token string, _ error) { / return res.Payload.PMMAgent.AgentID, res.Payload.Token, nil } -// check interfaces +// check interfaces. var ( _ error = nginxError("") _ fmt.GoStringer = nginxError("") diff --git a/agent/config/logger.go b/agent/config/logger.go index 1daa9e513b..570ab0dbfa 100644 --- a/agent/config/logger.go +++ b/agent/config/logger.go @@ -32,7 +32,7 @@ func (v *gRPCLogger) V(l int) bool { return true } -// override InfoXXX methods with TraceXXX to keep gRPC and logrus levels in sync +// override InfoXXX methods with TraceXXX to keep gRPC and logrus levels in sync. func (v *gRPCLogger) Info(args ...interface{}) { v.Trace(args...) } func (v *gRPCLogger) Infoln(args ...interface{}) { v.Traceln(args...) } func (v *gRPCLogger) Infof(format string, args ...interface{}) { v.Tracef(format, args...) } diff --git a/agent/connectionuptime/service.go b/agent/connectionuptime/service.go index 49ec3bc0b0..5bac5c4555 100644 --- a/agent/connectionuptime/service.go +++ b/agent/connectionuptime/service.go @@ -26,7 +26,7 @@ import ( const periodForRunningDeletingOldEvents = time.Minute // Service calculates connection uptime between agent and server -// based on the connection events +// based on the connection events. type Service struct { mx sync.Mutex events []connectionEvent @@ -39,7 +39,7 @@ type connectionEvent struct { Connected bool } -// NewService creates new instance of Service +// NewService creates new instance of Service. func NewService(windowPeriod time.Duration) *Service { return &Service{ windowPeriod: windowPeriod, @@ -47,7 +47,7 @@ func NewService(windowPeriod time.Duration) *Service { } } -// SetWindowPeriod updates window period +// SetWindowPeriod updates window period. func (c *Service) SetWindowPeriod(windowPeriod time.Duration) { c.mx.Lock() defer c.mx.Unlock() @@ -55,7 +55,7 @@ func (c *Service) SetWindowPeriod(windowPeriod time.Duration) { c.windowPeriod = windowPeriod } -// RegisterConnectionStatus adds connection event +// RegisterConnectionStatus adds connection event. func (c *Service) RegisterConnectionStatus(timestamp time.Time, connected bool) { c.mx.Lock() defer c.mx.Unlock() diff --git a/agent/runner/actions/common.go b/agent/runner/actions/common.go index adff5d5bd0..44f8bb5151 100644 --- a/agent/runner/actions/common.go +++ b/agent/runner/actions/common.go @@ -40,7 +40,7 @@ var whiteSpacesRegExp = regexp.MustCompile(`\s+`) // ["value 1", 2, …] // … // -// ] +// ]. func jsonRows(columns []string, dataRows [][]interface{}) ([]byte, error) { res := make([][]interface{}, len(dataRows)+1) diff --git a/agent/runner/jobs/backup_location.go b/agent/runner/jobs/backup_location.go index 684525ae29..b77bf1e418 100644 --- a/agent/runner/jobs/backup_location.go +++ b/agent/runner/jobs/backup_location.go @@ -32,7 +32,7 @@ type S3LocationConfig struct { BucketRegion string } -// FilesystemBackupLocationConfig contains config for local storage +// FilesystemBackupLocationConfig contains config for local storage. type FilesystemBackupLocationConfig struct { Path string } diff --git a/agent/runner/jobs/mysql_restore_job.go b/agent/runner/jobs/mysql_restore_job.go index 761ce2ef5e..d5b528de22 100644 --- a/agent/runner/jobs/mysql_restore_job.go +++ b/agent/runner/jobs/mysql_restore_job.go @@ -38,7 +38,7 @@ const ( xbstreamBin = "xbstream" mySQLSystemUserName = "mysql" mySQLSystemGroupName = "mysql" - // TODO make mySQLDirectory autorecognized as done in 'xtrabackup' utility; see 'xtrabackup --help' --datadir parameter + // TODO make mySQLDirectory autorecognized as done in 'xtrabackup' utility; see 'xtrabackup --help' --datadir parameter. mySQLDirectory = "/var/lib/mysql" systemctlTimeout = 10 * time.Second ) @@ -428,7 +428,7 @@ func restoreBackup(ctx context.Context, backupDirectory, mySQLDirectory string) return nil } -// getMysqlServiceName returns MySQL system service name +// getMysqlServiceName returns MySQL system service name. func getMysqlServiceName(ctx context.Context) (string, error) { ctx, cancel := context.WithTimeout(ctx, systemctlTimeout) defer cancel() diff --git a/agent/runner/jobs/pbm_helpers.go b/agent/runner/jobs/pbm_helpers.go index c1afcd5505..b8f5777c8b 100644 --- a/agent/runner/jobs/pbm_helpers.go +++ b/agent/runner/jobs/pbm_helpers.go @@ -457,7 +457,7 @@ func writePBMConfigFile(conf *PBMConfig) (string, error) { return tmp.Name(), tmp.Close() } -// Serialization helpers +// Serialization helpers. // Storage represents target storage parameters. type Storage struct { diff --git a/agent/tailog/store.go b/agent/tailog/store.go index 45ff99c8d9..e558125f7a 100644 --- a/agent/tailog/store.go +++ b/agent/tailog/store.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package tailog helps store tail logs +// Package tailog helps store tail logs. package tailog import ( diff --git a/agent/utils/version/postgresql.go b/agent/utils/version/postgresql.go index a950a764eb..71f5d44eca 100644 --- a/agent/utils/version/postgresql.go +++ b/agent/utils/version/postgresql.go @@ -19,7 +19,7 @@ import ( "strings" ) -// regexps to extract version numbers from the `SELECT version()` output +// regexps to extract version numbers from the `SELECT version()` output. var ( postgresDBRegexp = regexp.MustCompile(`PostgreSQL ([\d\.]+)`) ) diff --git a/api-tests/helpers.go b/api-tests/helpers.go index 20d27307a6..1b280fd192 100644 --- a/api-tests/helpers.go +++ b/api-tests/helpers.go @@ -225,7 +225,7 @@ func AddPMMAgent(t TestingT, nodeID string) *agents.AddPMMAgentOKBody { return res.Payload } -// check interfaces +// check interfaces. var ( _ assert.TestingT = (*expectedFailureTestingT)(nil) _ require.TestingT = (*expectedFailureTestingT)(nil) diff --git a/api-tests/init.go b/api-tests/init.go index a750ed683f..d581c00fcb 100644 --- a/api-tests/init.go +++ b/api-tests/init.go @@ -235,7 +235,7 @@ func init() { } } -// check interfaces +// check interfaces. var ( _ error = (*NginxError)(nil) _ fmt.GoStringer = (*NginxError)(nil) diff --git a/api/agentpb/agent.go b/api/agentpb/agent.go index b866f40fe9..4b90297431 100644 --- a/api/agentpb/agent.go +++ b/api/agentpb/agent.go @@ -198,7 +198,7 @@ func (m *AgentLogsRequest) ServerMessageRequestPayload() isServerMessage_Payload return &ServerMessage_AgentLogs{AgentLogs: m} } -// in alphabetical order +// in alphabetical order. func (*ActionResultRequest) sealed() {} func (*ActionResultResponse) sealed() {} func (*CheckConnectionRequest) sealed() {} @@ -230,7 +230,7 @@ func (*GetVersionsResponse) sealed() {} func (*PBMSwitchPITRRequest) sealed() {} func (*PBMSwitchPITRResponse) sealed() {} -// check interfaces +// check interfaces. var ( // A list of AgentMessage request payloads. _ AgentRequestPayload = (*Ping)(nil) diff --git a/api/inventorypb/agents.go b/api/inventorypb/agents.go index 7d1f103dbb..8b919fe4eb 100644 --- a/api/inventorypb/agents.go +++ b/api/inventorypb/agents.go @@ -22,7 +22,7 @@ type Agent interface { sealedAgent() } -// Ordered the same as AgentType enum +// Ordered the same as AgentType enum. func (*PMMAgent) sealedAgent() {} func (*VMAgent) sealedAgent() {} diff --git a/api/inventorypb/agents_test.go b/api/inventorypb/agents_test.go index c331e999df..2926fb74ca 100644 --- a/api/inventorypb/agents_test.go +++ b/api/inventorypb/agents_test.go @@ -28,7 +28,7 @@ import ( // names is up to date with the types defined in AgentType_name by the proto definition // by calling the AgentTypeName function using the values from protobuf and it expects the // result is a non-empty string, meaning that the AgentTypeNames list matches the proto -// definitions +// definitions. func TestAgentTypes(t *testing.T) { for _, val := range AgentType_name { if strings.HasSuffix(val, "INVALID") { diff --git a/api/inventorypb/nodes.go b/api/inventorypb/nodes.go index e92d7876ac..5612d35323 100644 --- a/api/inventorypb/nodes.go +++ b/api/inventorypb/nodes.go @@ -22,7 +22,7 @@ type Node interface { sealedNode() } -// Ordered the same as NodeType enum +// Ordered the same as NodeType enum. func (*GenericNode) sealedNode() {} func (*ContainerNode) sealedNode() {} diff --git a/api/inventorypb/nodes_test.go b/api/inventorypb/nodes_test.go index b677e27239..f5e7399323 100644 --- a/api/inventorypb/nodes_test.go +++ b/api/inventorypb/nodes_test.go @@ -28,7 +28,7 @@ import ( // names is up to date with the types defined in Nodetype_name by the proto definition // by calling the NodetypeName function using the values from protobuf and it expects the // result is a non-empty string, meaning that the NodetypeNames list matches the proto -// definitions +// definitions. func TestNodeTypes(t *testing.T) { for _, val := range NodeType_name { if strings.HasSuffix(val, "INVALID") { diff --git a/api/inventorypb/services.go b/api/inventorypb/services.go index 2c2162b87c..f4aa147f43 100644 --- a/api/inventorypb/services.go +++ b/api/inventorypb/services.go @@ -22,7 +22,7 @@ type Service interface { sealedService() } -// Ordered the same as ServiceType enum +// Ordered the same as ServiceType enum. func (*MySQLService) sealedService() {} func (*MongoDBService) sealedService() {} diff --git a/api/inventorypb/services_test.go b/api/inventorypb/services_test.go index a9a63836af..dd2697d948 100644 --- a/api/inventorypb/services_test.go +++ b/api/inventorypb/services_test.go @@ -28,7 +28,7 @@ import ( // names is up to date with the types defined in ServiceType_name by the proto definition // by calling the ServiceTypeName function using the values from protobuf and it expects the // result is a non-empty string, meaning that the ServiceTypeNames list matches the proto -// definitions +// definitions. func TestServiceTypes(t *testing.T) { for _, val := range ServiceType_name { if strings.HasSuffix(val, "INVALID") { diff --git a/api/inventorypb/types/agent_types.go b/api/inventorypb/types/agent_types.go index 26a287e2b0..56817deb9a 100644 --- a/api/inventorypb/types/agent_types.go +++ b/api/inventorypb/types/agent_types.go @@ -18,7 +18,7 @@ package types import "fmt" -// this list should be in sync with inventorypb/agents.pb.go +// this list should be in sync with inventorypb/agents.pb.go. const ( AgentTypePMMAgent = "PMM_AGENT" AgentTypeVMAgent = "VM_AGENT" @@ -56,7 +56,7 @@ var agentTypeNames = map[string]string{ AgentTypeAzureDatabaseExporter: "azure_database_exporter", } -// AgentTypeName returns human friendly agent type to be used in reports +// AgentTypeName returns human friendly agent type to be used in reports. func AgentTypeName(t string) string { res := agentTypeNames[t] if res == "" { diff --git a/api/inventorypb/types/node_types.go b/api/inventorypb/types/node_types.go index b142edd1c8..e861436d5e 100644 --- a/api/inventorypb/types/node_types.go +++ b/api/inventorypb/types/node_types.go @@ -17,7 +17,7 @@ package types import "fmt" -// this list should be in sync with inventorypb/nodes.pb.go +// this list should be in sync with inventorypb/nodes.pb.go. const ( NodeTypeGenericNode = "GENERIC_NODE" NodeTypeContainerNode = "CONTAINER_NODE" @@ -35,7 +35,7 @@ var nodeTypeNames = map[string]string{ NodeTypeRemoteAzureDatabaseNode: "Remote Azure database", } -// NodeTypeName returns human friendly node type to be used in reports +// NodeTypeName returns human friendly node type to be used in reports. func NodeTypeName(t string) string { res := nodeTypeNames[t] if res == "" { diff --git a/api/inventorypb/types/service_types.go b/api/inventorypb/types/service_types.go index ab3ede1977..a1b24ba061 100644 --- a/api/inventorypb/types/service_types.go +++ b/api/inventorypb/types/service_types.go @@ -17,7 +17,7 @@ package types import "fmt" -// this list should be in sync with inventorypb/services.pb.go +// this list should be in sync with inventorypb/services.pb.go. const ( ServiceTypeMySQLService = "MYSQL_SERVICE" ServiceTypeMongoDBService = "MONGODB_SERVICE" @@ -37,7 +37,7 @@ var serviceTypeNames = map[string]string{ ServiceTypeExternalService: "External", } -// ServiceTypeName returns human friendly service type to be used in reports +// ServiceTypeName returns human friendly service type to be used in reports. func ServiceTypeName(t string) string { res := serviceTypeNames[t] if res == "" { diff --git a/managed/cmd/pmm-managed-starlark/main_test.go b/managed/cmd/pmm-managed-starlark/main_test.go index 1eaa23d17b..e7a03037e1 100644 --- a/managed/cmd/pmm-managed-starlark/main_test.go +++ b/managed/cmd/pmm-managed-starlark/main_test.go @@ -37,7 +37,7 @@ const ( // Possible errors: // fatal error: runtime: out of memory - // fatal error: out of memory allocating heap arena metadata + // fatal error: out of memory allocating heap arena metadatai. memoryConsumingScriptStderr = "out of memory" ) diff --git a/managed/models/action_models.go b/managed/models/action_models.go index e6bc10876c..eee93990d2 100644 --- a/managed/models/action_models.go +++ b/managed/models/action_models.go @@ -57,7 +57,7 @@ func (s *ActionResult) AfterFind() error { return nil } -// check interfaces +// check interfaces. var ( _ reform.BeforeInserter = (*ActionResult)(nil) _ reform.BeforeUpdater = (*ActionResult)(nil) diff --git a/managed/models/database_test.go b/managed/models/database_test.go index 083ab679a6..f58cd39e1d 100644 --- a/managed/models/database_test.go +++ b/managed/models/database_test.go @@ -32,7 +32,7 @@ import ( "github.com/percona/pmm/managed/utils/testdb" ) -// See https://www.postgresql.org/docs/10/errcodes-appendix.html for error codes +// See https://www.postgresql.org/docs/10/errcodes-appendix.html for error codes. func assertUniqueViolation(t *testing.T, err error, constraint string) { t.Helper() diff --git a/managed/models/kubernetes_helpers.go b/managed/models/kubernetes_helpers.go index 7c2a2d9447..fad875311d 100644 --- a/managed/models/kubernetes_helpers.go +++ b/managed/models/kubernetes_helpers.go @@ -117,7 +117,7 @@ func CreateKubernetesCluster(q *reform.Querier, params *CreateKubernetesClusterP return row, nil } -// ChangeKubernetesClusterToReady changes k8s cluster to ready state once provisioning is finished +// ChangeKubernetesClusterToReady changes k8s cluster to ready state once provisioning is finished. func ChangeKubernetesClusterToReady(q *reform.Querier, name string) error { c, err := FindKubernetesClusterByName(q, name) if err != nil { diff --git a/managed/models/kubernetes_models.go b/managed/models/kubernetes_models.go index 1fa98726f4..55e875265e 100644 --- a/managed/models/kubernetes_models.go +++ b/managed/models/kubernetes_models.go @@ -24,7 +24,7 @@ import ( //go:generate ../../bin/reform -// Component stores info about DBaaS Component +// Component stores info about DBaaS Component. type Component struct { DisabledVersions []string DefaultVersion string diff --git a/managed/models/location_model.go b/managed/models/location_model.go index ddde641b1b..9cb2246acb 100644 --- a/managed/models/location_model.go +++ b/managed/models/location_model.go @@ -27,7 +27,7 @@ import ( // BackupLocationType represents BackupLocation type as stored in database. type BackupLocationType string -// BackupLocation types. Same as in agent/runner/jobs/backup_location.go +// BackupLocation types. Same as in agent/runner/jobs/backup_location.go. const ( S3BackupLocationType BackupLocationType = "s3" FilesystemBackupLocationType BackupLocationType = "filesystem" diff --git a/managed/models/node_model.go b/managed/models/node_model.go index c6ebdf104a..07587fb50e 100644 --- a/managed/models/node_model.go +++ b/managed/models/node_model.go @@ -134,7 +134,7 @@ func (s *Node) UnifiedLabels() (map[string]string, error) { return res, nil } -// check interfaces +// check interfaces. var ( _ reform.BeforeInserter = (*Node)(nil) _ reform.BeforeUpdater = (*Node)(nil) diff --git a/managed/models/postgresql_version.go b/managed/models/postgresql_version.go index a5e6cb53eb..2a5cba30e9 100644 --- a/managed/models/postgresql_version.go +++ b/managed/models/postgresql_version.go @@ -24,7 +24,7 @@ import ( "gopkg.in/reform.v1" ) -// regexps to extract version numbers from the `SELECT version()` output +// regexps to extract version numbers from the `SELECT version()` output. var ( postgresDBRegexp = regexp.MustCompile(`PostgreSQL (\d+\.?\d+)`) ) diff --git a/managed/models/service_model.go b/managed/models/service_model.go index fe3c3cc145..721e59ed64 100644 --- a/managed/models/service_model.go +++ b/managed/models/service_model.go @@ -132,7 +132,7 @@ func (s *Service) UnifiedLabels() (map[string]string, error) { return res, nil } -// check interfaces +// check interfaces. var ( _ reform.BeforeInserter = (*Service)(nil) _ reform.BeforeUpdater = (*Service)(nil) diff --git a/managed/services/converters.go b/managed/services/converters.go index edfcf3f4e9..299776441c 100644 --- a/managed/services/converters.go +++ b/managed/services/converters.go @@ -475,7 +475,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventorypb.Agent, erro } // SpecifyLogLevel - convert proto enum to string -// mysqld_exporter, node_exporter and postgres_exporter don't support --log.level=fatal +// mysqld_exporter, node_exporter and postgres_exporter don't support --log.level=fatal. func SpecifyLogLevel(variant, minLogLevel inventorypb.LogLevel) string { if variant == inventorypb.LogLevel_auto { return "" diff --git a/managed/services/dbaas/kubernetes/client/database/database.go b/managed/services/dbaas/kubernetes/client/database/database.go index f803a10e72..d5a0aacda7 100644 --- a/managed/services/dbaas/kubernetes/client/database/database.go +++ b/managed/services/dbaas/kubernetes/client/database/database.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package database TODO +// Package database TODO. package database import ( diff --git a/managed/services/management/ia/alerts_service.go b/managed/services/management/ia/alerts_service.go index fe882023e8..575d3c687f 100644 --- a/managed/services/management/ia/alerts_service.go +++ b/managed/services/management/ia/alerts_service.go @@ -38,7 +38,7 @@ import ( ) // AlertsService represents integrated alerting alerts API. -// Deprecated. Do not use +// Deprecated. Do not use. type AlertsService struct { db *reform.DB l *logrus.Entry @@ -59,7 +59,7 @@ func NewAlertsService(db *reform.DB, alertManager alertManager, templatesService } // Enabled returns if service is enabled and can be used. -// Deprecated. Do not use +// Deprecated. Do not use. func (s *AlertsService) Enabled() bool { settings, err := models.GetSettings(s.db) if err != nil { @@ -70,7 +70,7 @@ func (s *AlertsService) Enabled() bool { } // ListAlerts returns list of existing alerts. -// Deprecated. Do not use +// Deprecated. Do not use. func (s *AlertsService) ListAlerts(ctx context.Context, req *iav1beta1.ListAlertsRequest) (*iav1beta1.ListAlertsResponse, error) { filter := &services.FilterParams{ IsIA: true, @@ -228,7 +228,7 @@ func getAlertID(alert *ammodels.GettableAlert) string { } // ToggleAlerts allows to silence/unsilence specified alerts. -// Deprecated. Do not use +// Deprecated. Do not use. func (s *AlertsService) ToggleAlerts(ctx context.Context, req *iav1beta1.ToggleAlertsRequest) (*iav1beta1.ToggleAlertsResponse, error) { var err error var alerts []*ammodels.GettableAlert diff --git a/managed/services/management/ia/rules_service_test.go b/managed/services/management/ia/rules_service_test.go index 542e621cb2..f264e6c5c5 100644 --- a/managed/services/management/ia/rules_service_test.go +++ b/managed/services/management/ia/rules_service_test.go @@ -358,7 +358,7 @@ import ( // _, err = os.Stat(filename) // assert.EqualError(t, err, fmt.Sprintf("stat %s: no such file or directory", filename)) // }) -// } +// }. */ func ruleFileName(testDir, ruleID string) string { diff --git a/managed/services/management/rds.go b/managed/services/management/rds.go index fbcc349ccc..4b4b2723d0 100644 --- a/managed/services/management/rds.go +++ b/managed/services/management/rds.go @@ -43,7 +43,7 @@ import ( ) const ( - // Maximum time for AWS discover APIs calls + // Maximum time for AWS discover APIs calls. awsDiscoverTimeout = 7 * time.Second ) @@ -66,7 +66,7 @@ func NewRDSService(db *reform.DB, state agentsStateUpdater, cc connectionChecker } var ( - // See https://pkg.go.dev/github.com/aws/aws-sdk-go/service/rds?tab=doc#CreateDBInstanceInput, Engine field + // See https://pkg.go.dev/github.com/aws/aws-sdk-go/service/rds?tab=doc#CreateDBInstanceInput, Engine field. rdsEngines = map[string]managementpb.DiscoverRDSEngine{ "aurora-mysql": managementpb.DiscoverRDSEngine_DISCOVER_RDS_MYSQL, // MySQL 5.7-compatible Aurora diff --git a/managed/services/supervisord/supervisord.go b/managed/services/supervisord/supervisord.go index 3a596c54e2..29490ff66d 100644 --- a/managed/services/supervisord/supervisord.go +++ b/managed/services/supervisord/supervisord.go @@ -76,7 +76,7 @@ type sub struct { eventTypes []eventType } -// values from supervisord configuration +// values from supervisord configuration. const ( pmmUpdatePerformProgram = "pmm-update-perform" pmmUpdatePerformLog = "/srv/logs/pmm-update-perform.log" diff --git a/managed/services/telemetry/datasource_pmmdb_select.go b/managed/services/telemetry/datasource_pmmdb_select.go index 6e2d03c040..75bfdc9d7b 100644 --- a/managed/services/telemetry/datasource_pmmdb_select.go +++ b/managed/services/telemetry/datasource_pmmdb_select.go @@ -33,7 +33,7 @@ type dsPmmDBSelect struct { db *sql.DB } -// check interfaces +// check interfaces. var ( _ DataSource = (*dsPmmDBSelect)(nil) ) diff --git a/managed/services/telemetry/datasource_qandb_select.go b/managed/services/telemetry/datasource_qandb_select.go index d53a122d86..0aa29a5778 100644 --- a/managed/services/telemetry/datasource_qandb_select.go +++ b/managed/services/telemetry/datasource_qandb_select.go @@ -31,7 +31,7 @@ type dsQanDBSelect struct { db *sql.DB } -// check interfaces +// check interfaces. var ( _ DataSource = (*dsQanDBSelect)(nil) ) diff --git a/managed/services/telemetry/datasource_victoria_metrics.go b/managed/services/telemetry/datasource_victoria_metrics.go index 7b3365f31c..2c406d4301 100644 --- a/managed/services/telemetry/datasource_victoria_metrics.go +++ b/managed/services/telemetry/datasource_victoria_metrics.go @@ -33,7 +33,7 @@ type dataSourceVictoriaMetrics struct { vm v1.API } -// check interfaces +// check interfaces. var ( _ DataSource = (*dataSourceVictoriaMetrics)(nil) ) diff --git a/managed/services/telemetry/datasources.go b/managed/services/telemetry/datasources.go index 79276d8aac..6f116bc0e9 100644 --- a/managed/services/telemetry/datasources.go +++ b/managed/services/telemetry/datasources.go @@ -35,7 +35,7 @@ type dataSourceRegistry struct { dataSources map[DataSourceName]DataSource } -// NewDataSourceRegistry makes new data source registry +// NewDataSourceRegistry makes new data source registry. func NewDataSourceRegistry(config ServiceConfig, l *logrus.Entry) (DataSourceLocator, error) { //nolint:ireturn pmmDB, err := NewDsPmmDBSelect(*config.DataSources.PmmDBSelect, l) if err != nil { diff --git a/managed/services/telemetry/deps.go b/managed/services/telemetry/deps.go index 148bd529a7..465e757e95 100644 --- a/managed/services/telemetry/deps.go +++ b/managed/services/telemetry/deps.go @@ -29,12 +29,12 @@ import ( //go:generate ../../../bin/mockery --name=DataSourceLocator --case=snake --inpackage --testonly //go:generate ../../../bin/mockery --name=DataSource --case=snake --inpackage --testonly -// distributionUtilService service to get info about OS on which pmm server is running +// distributionUtilService service to get info about OS on which pmm server is running. type distributionUtilService interface { getDistributionMethodAndOS() (serverpb.DistributionMethod, pmmv1.DistributionMethod, string) } -// sender is interface which defines method for client which sends report with metrics +// sender is interface which defines method for client which sends report with metrics. type sender interface { SendTelemetry(ctx context.Context, report *reporter.ReportRequest) error } diff --git a/managed/services/telemetry/telemetry.go b/managed/services/telemetry/telemetry.go index 9e9ebdd142..be935063a2 100644 --- a/managed/services/telemetry/telemetry.go +++ b/managed/services/telemetry/telemetry.go @@ -63,7 +63,7 @@ type Service struct { dus distributionUtilService } -// check interfaces +// check interfaces. var ( _ DataSourceLocator = (*Service)(nil) ) @@ -412,7 +412,7 @@ func (s *Service) Format(report *pmmv1.ServerMetric) string { return builder.String() } -// GetSummaries returns the list of gathered telemetry +// GetSummaries returns the list of gathered telemetry. func (s *Service) GetSummaries() []string { result := make([]string, 0, len(s.config.telemetry)) for _, c := range s.config.telemetry { diff --git a/managed/services/user/user.go b/managed/services/user/user.go index cf986378a6..0934c93809 100644 --- a/managed/services/user/user.go +++ b/managed/services/user/user.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package user provides API for user related tasks +// Package user provides API for user related tasks. package user import ( @@ -55,7 +55,7 @@ func NewUserService(db *reform.DB, client grafanaClient) *Service { return &s } -// GetUser creates a new user +// GetUser creates a new user. func (s *Service) GetUser(ctx context.Context, _ *userpb.UserDetailsRequest) (*userpb.UserDetailsResponse, error) { userID, err := s.c.GetUserID(ctx) if err != nil { diff --git a/managed/utils/interceptors/grpc_extension.go b/managed/utils/interceptors/grpc_extension.go index 83455c85e5..16b8c4b584 100644 --- a/managed/utils/interceptors/grpc_extension.go +++ b/managed/utils/interceptors/grpc_extension.go @@ -32,7 +32,7 @@ const ( externalCallerOrigin = callerOrigin("external") ) -// GRPCMetricsExtension for extra labels in /debug/metrics +// GRPCMetricsExtension for extra labels in /debug/metrics. type GRPCMetricsExtension struct { grpc_prometheus.DefaultExtension } diff --git a/managed/utils/interceptors/interceptors.go b/managed/utils/interceptors/interceptors.go index 382d30796d..a783a4ab2b 100644 --- a/managed/utils/interceptors/interceptors.go +++ b/managed/utils/interceptors/interceptors.go @@ -142,7 +142,7 @@ func Stream(interceptor grpc.StreamServerInterceptor) func(srv interface{}, ss g } } -// check interfaces +// check interfaces. var ( _ grpc.UnaryServerInterceptor = Unary(nil) _ grpc.StreamServerInterceptor = Stream(nil) diff --git a/managed/utils/irt/metrics.go b/managed/utils/irt/metrics.go index 19c9876ee0..e895325ee4 100644 --- a/managed/utils/irt/metrics.go +++ b/managed/utils/irt/metrics.go @@ -75,7 +75,7 @@ func (m *metrics) Collect(ch chan<- prom.Metric) { m.duration.Collect(ch) } -// check interfaces +// check interfaces. var ( _ prom.Collector = (*metrics)(nil) ) diff --git a/managed/utils/tests/id.go b/managed/utils/tests/id.go index b02ab45804..846a1d9083 100644 --- a/managed/utils/tests/id.go +++ b/managed/utils/tests/id.go @@ -52,7 +52,7 @@ func SetTestIDReader(t *testing.T) { t.Cleanup(func() { uuid.SetRand(nil) }) } -// check interfaces +// check interfaces. var ( _ io.Reader = (*IDReader)(nil) ) diff --git a/qan-api2/models/data_ingestion.go b/qan-api2/models/data_ingestion.go index 126052c9b4..6a8746ccbf 100644 --- a/qan-api2/models/data_ingestion.go +++ b/qan-api2/models/data_ingestion.go @@ -509,7 +509,7 @@ type MetricsBucketExtended struct { *qanpb.MetricsBucket } -// MetricsBucket implements models to store metrics bucket +// MetricsBucket implements models to store metrics bucket. type MetricsBucket struct { db *sqlx.DB l *logrus.Entry @@ -747,7 +747,7 @@ func mapToArrsIntInt(m map[uint64]uint64) ([]uint64, []uint64) { return keys, values } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*MetricsBucket)(nil) ) diff --git a/qan-api2/services/analytics/filters_test.go b/qan-api2/services/analytics/filters_test.go index c7afc95c5a..163ffd8c25 100644 --- a/qan-api2/services/analytics/filters_test.go +++ b/qan-api2/services/analytics/filters_test.go @@ -24,7 +24,7 @@ import ( "time" _ "github.com/ClickHouse/clickhouse-go/151" // register database/sql driver - // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated. "github.com/golang/protobuf/ptypes/timestamp" "github.com/jmoiron/sqlx" "github.com/stretchr/testify/assert" diff --git a/qan-api2/services/analytics/object_details_test.go b/qan-api2/services/analytics/object_details_test.go index 6a0173949c..9bc076f37b 100644 --- a/qan-api2/services/analytics/object_details_test.go +++ b/qan-api2/services/analytics/object_details_test.go @@ -21,7 +21,7 @@ import ( "testing" "time" - // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated. "github.com/golang/protobuf/jsonpb" //nolint:staticcheck "github.com/golang/protobuf/ptypes/timestamp" "github.com/stretchr/testify/assert" diff --git a/qan-api2/services/analytics/profile_test.go b/qan-api2/services/analytics/profile_test.go index 429a7c1211..8597d17a93 100644 --- a/qan-api2/services/analytics/profile_test.go +++ b/qan-api2/services/analytics/profile_test.go @@ -23,9 +23,9 @@ import ( "testing" "time" - // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated. "github.com/golang/protobuf/jsonpb" //nolint:staticcheck - // TODO replace with 'google.golang.org/protobuf/proto' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/proto' since this one is deprecated. "github.com/golang/protobuf/proto" //nolint:staticcheck "github.com/golang/protobuf/ptypes/timestamp" "github.com/jmoiron/sqlx" diff --git a/qan-api2/utils/interceptors/interceptors.go b/qan-api2/utils/interceptors/interceptors.go index c5aca053fb..d60ef711f8 100644 --- a/qan-api2/utils/interceptors/interceptors.go +++ b/qan-api2/utils/interceptors/interceptors.go @@ -124,7 +124,7 @@ func Stream(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, return err } -// check interfaces +// check interfaces. var ( _ grpc.UnaryServerInterceptor = Unary _ grpc.StreamServerInterceptor = Stream diff --git a/qan-api2/utils/logger/grpc.go b/qan-api2/utils/logger/grpc.go index d658750634..f6e2673182 100644 --- a/qan-api2/utils/logger/grpc.go +++ b/qan-api2/utils/logger/grpc.go @@ -38,7 +38,7 @@ func (v *GRPC) Info(args ...interface{}) { v.Trace(args...) } func (v *GRPC) Infoln(args ...interface{}) { v.Traceln(args...) } func (v *GRPC) Infof(format string, args ...interface{}) { v.Tracef(format, args...) } -// check interfaces +// check interfaces. var ( _ grpclog.LoggerV2 = (*GRPC)(nil) ) diff --git a/qan-api2/utils/logger/logger.go b/qan-api2/utils/logger/logger.go index d51b3cc4f6..45bfe362ef 100644 --- a/qan-api2/utils/logger/logger.go +++ b/qan-api2/utils/logger/logger.go @@ -23,7 +23,7 @@ import ( "github.com/sirupsen/logrus" ) -// key is unexported to prevent collisions - it is different from any other type in other packages +// key is unexported to prevent collisions - it is different from any other type in other packages. var key = struct{}{} // Get returns logrus entry for given context. Set must be called before this method is called. diff --git a/utils/errors/errors.go b/utils/errors/errors.go index 1924f38d88..9550f5843e 100644 --- a/utils/errors/errors.go +++ b/utils/errors/errors.go @@ -15,7 +15,7 @@ // Package errors contains a custom HTTP error handler that adds an extra `Error` field to error payloads. // This helps us maintain compatibility with older PMM clients while keeping the benefits of grpc-gateway v2. -// Our requirement is fairly minimal, but copy a lot of code from grpc-gateway to account for unexported fields and methods +// Our requirement is fairly minimal, but copy a lot of code from grpc-gateway to account for unexported fields and methods. package errors import ( @@ -37,7 +37,7 @@ import ( // PMMHTTPErrorHandler is a custom implementation of DefaultHTTPErrorHandler // (https://github.com/grpc-ecosystem/grpc-gateway/blob/aec6aa29864109e41408491319a859f190ec4040/runtime/errors.go#L93) -// It injects an extra `Error` field in error responses to support old PMM clients +// It injects an extra `Error` field in error responses to support old PMM clients. func PMMHTTPErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) { // return Internal when Marshal failed const fallback = `{"code": 13, "message": "failed to marshal error message"}` diff --git a/utils/logger/grpc.go b/utils/logger/grpc.go index 15c761c217..1b5c04998d 100644 --- a/utils/logger/grpc.go +++ b/utils/logger/grpc.go @@ -38,7 +38,7 @@ func (v *GRPC) Info(args ...interface{}) { v.Trace(args...) } func (v *GRPC) Infoln(args ...interface{}) { v.Traceln(args...) } func (v *GRPC) Infof(format string, args ...interface{}) { v.Tracef(format, args...) } -// check interfaces +// check interfaces. var ( _ grpclog.LoggerV2 = (*GRPC)(nil) ) diff --git a/utils/logger/logger.go b/utils/logger/logger.go index b47b60f28e..2ff85b60a0 100644 --- a/utils/logger/logger.go +++ b/utils/logger/logger.go @@ -23,7 +23,7 @@ import ( "github.com/sirupsen/logrus" ) -// key is unexported to prevent collisions - it is different from any other type in other packages +// key is unexported to prevent collisions - it is different from any other type in other packages. type key struct{} // Get returns logrus entry for given context. Set must be called before this method is called. diff --git a/utils/nodeinfo/nodeinfo.go b/utils/nodeinfo/nodeinfo.go index 5e0ac2539d..c8ade0b3a2 100644 --- a/utils/nodeinfo/nodeinfo.go +++ b/utils/nodeinfo/nodeinfo.go @@ -68,7 +68,7 @@ func readMachineID() string { return "" } -// TODO remove that completely once we have "zero port" feature +// TODO remove that completely once we have "zero port" feature. func readPublicAddress() string { var res string diff --git a/utils/sqlmetrics/sqlmetrics.go b/utils/sqlmetrics/sqlmetrics.go index 9404cb91c4..3fe412feb3 100644 --- a/utils/sqlmetrics/sqlmetrics.go +++ b/utils/sqlmetrics/sqlmetrics.go @@ -137,7 +137,7 @@ func (c *Collector) Collect(ch chan<- prom.Metric) { float64(stats.MaxLifetimeClosed)) } -// check interfaces +// check interfaces. var ( _ prom.Collector = (*Collector)(nil) ) diff --git a/utils/sqlrows/sqlrows.go b/utils/sqlrows/sqlrows.go index 7255f427c0..35f72a55e0 100644 --- a/utils/sqlrows/sqlrows.go +++ b/utils/sqlrows/sqlrows.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package sqlrows provides helper methods for *sql.Rows +// Package sqlrows provides helper methods for *sql.Rows. package sqlrows import "database/sql" diff --git a/version/release.go b/version/release.go index 1560e45a5d..7e74cfc8df 100644 --- a/version/release.go +++ b/version/release.go @@ -71,7 +71,7 @@ func Time() (time.Time, error) { return time.Unix(sec, 0).UTC(), nil } -// timestampFormatted returns timestamp in format "YYYY-MM-DD HH:mm:ss (UTC)" +// timestampFormatted returns timestamp in format "YYYY-MM-DD HH:mm:ss (UTC)". func timestampFormatted() string { timestamp := Timestamp if t, err := Time(); err == nil { diff --git a/vmproxy/proxy/proxy.go b/vmproxy/proxy/proxy.go index 8fcb9e6683..20fa20f33d 100644 --- a/vmproxy/proxy/proxy.go +++ b/vmproxy/proxy/proxy.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package proxy provides http reverse proxy functionality +// Package proxy provides http reverse proxy functionality. package proxy import ( @@ -30,7 +30,7 @@ import ( "github.com/sirupsen/logrus" ) -// Config defines options for starting proxy +// Config defines options for starting proxy. type Config struct { // Name of the header to check for filters. Case insensitive. HeaderName string