From 22f2fe6683a0a3ad128db96df77465589c8d556a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Avic=20Simmons?= Date: Sat, 4 Jul 2026 14:55:31 -0400 Subject: [PATCH 1/2] docs: fix typos and grammar in code comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix misspellings: easiuly→easily, emitt→emit, URC→UTC, parsees→parses, collectionwindow→collection window - Fix grammar: aggregations→aggregation, ends→end, refer→refers, get→gets, setup→set up, exists→exists comma - Fix Go doc comments to use third-person verb form (creates, computes, updates) --- Config.go | 2 +- aggregationManager.go | 6 +++--- dbClient.go | 6 +++--- hmacAuth.go | 8 ++++---- logger.go | 8 ++++---- metrics.go | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Config.go b/Config.go index 5d3446d..6f7bdc7 100644 --- a/Config.go +++ b/Config.go @@ -79,7 +79,7 @@ type Config struct { TestHttpClient *http.Client `json:"-"` } -// Parse parsees configs from json file +// Parse parses configs from json file func ParseConfig(jsonConfig string, appConfig *Config) error { file, err := os.Open(jsonConfig) if err != nil { diff --git a/aggregationManager.go b/aggregationManager.go index 0b4c519..beb4c6f 100644 --- a/aggregationManager.go +++ b/aggregationManager.go @@ -42,7 +42,7 @@ func (a *AggregationManager) RegisterMetrics(reg gometrics.Registry) { reg.Register("aggregationManager.internal.plans_under_aggregation_total", gaugeAggregatedPlansTotal) } -// NewAggregationManager create new AggregationManager +// NewAggregationManager creates a new AggregationManager func NewAggregationManager(irisClient *IrisClient, config *Config, logger *Logger, quit chan int, wg *sync.WaitGroup, metricsRegistry *gometrics.Registry) *AggregationManager { aggregationManager := AggregationManager{ @@ -127,7 +127,7 @@ func (a *AggregationManager) resetAggregation() { } } else { if planAgg.incidentCount > 0 { - // if the collectionwindow has elapsed without triggering aggregation reset it and the count + // if the collection window has elapsed without triggering aggregation reset it and the count if time.Since(planAgg.collectionTime) > planAgg.collectionWindow { planAgg.incidentCount = 0 a.planAggregationMap[planAgg.planName] = planAgg @@ -139,7 +139,7 @@ func (a *AggregationManager) resetAggregation() { gaugeAggregatedPlansTotal.Update(aggregatedPlansTotal) } -// check if the aggregations settings have changed for each plan and update them if necessary +// check if the aggregation settings have changed for each plan and update them if necessary func (a *AggregationManager) updateSettings(aggSettingResp []PlanAggregationResp) { a.aggregationMutex.Lock() defer a.aggregationMutex.Unlock() diff --git a/dbClient.go b/dbClient.go index f76b4c6..e5cb9d7 100644 --- a/dbClient.go +++ b/dbClient.go @@ -131,7 +131,7 @@ func (d *DbClient) writeStatus(msgID string, statusStr string, vendorMessageIden return err } if len(storedRecord.MessageID) > 0 { - // a status already exists update it + // a status already exists, update it err = d.db.UpdateMessageStatus(newStatusRecord) if err != nil { d.logger.Errorf("Failed to update message status with error: %w", err) @@ -198,10 +198,10 @@ func (d *DbClient) getChangelogs(msgID string) ([]MessageChangelogRecord, error) // TODO implement the rest of the mysql functions alongside the apis to fetch messages and insert callbacks -// NewDbClient create new DbClient instance +// NewDbClient creates a new DbClient instance func NewDbClient(config *Config, logger *Logger, metricsRegistry *gometrics.Registry) *DbClient { - // interface allows the underlying db to be easiuly replaced with something else if needed + // interface allows the underlying db to be easily replaced with something else if needed var db DBInterface db = NewSQLDB(config, logger.Clone("mysql"), metricsRegistry) diff --git a/hmacAuth.go b/hmacAuth.go index 23a2deb..ea152d5 100644 --- a/hmacAuth.go +++ b/hmacAuth.go @@ -33,7 +33,7 @@ type AuthChecker struct { readyStatus bool } -// AuthHeader compute hmac authorization header and hmac hash +// AuthHeader computes the HMAC authorization header and hmac hash func AuthHeader(method, path string, body []byte, application string, key []byte) (string, string, error) { payload := strconv.AppendInt(make([]byte, 0), time.Now().UTC().Unix()/30, 10) payload = append(payload, ' ') @@ -62,7 +62,7 @@ func (a *AuthChecker) CheckStatus() bool { return a.readyStatus } -// CheckAuth evaluates a requests Authorization header +// CheckAuth evaluates a request's Authorization header func (a *AuthChecker) CheckAuth(request *http.Request) (bool, error) { // if auth debug mode is enabled skip checking authentication @@ -129,7 +129,7 @@ func (a *AuthChecker) CheckAuth(request *http.Request) (bool, error) { return true, nil } -// NewAuthChecker create new AuthChecker instance +// NewAuthChecker creates a new AuthChecker instance func NewAuthChecker(irisClient *IrisClient, config *Config, logger *Logger, quit chan int, wg *sync.WaitGroup, metricsRegistry *gometrics.Registry) *AuthChecker { authChecker := AuthChecker{ @@ -149,7 +149,7 @@ func NewAuthChecker(irisClient *IrisClient, config *Config, logger *Logger, quit return &authChecker } -// Run update application auth info every 60 seconds +// Run updates the application auth info every 60 seconds func (a *AuthChecker) Run() { // close wg to signal main process we have gracefully terminated defer a.mainWg.Done() diff --git a/logger.go b/logger.go index ff46900..d819cd7 100644 --- a/logger.go +++ b/logger.go @@ -3,7 +3,7 @@ // embed zap's SugaredLogger for structured logging (use methods that // ends in `w', e.g. Infow, Debugw). For documentation refer to // https://pkg.go.dev/go.uber.org/zap?tab=doc#SugaredLogger. User -// should setup log rotation when initializing this logger. +// should set up log rotation when initializing this logger. // // Uses zap and lumberjack. package main @@ -21,7 +21,7 @@ import ( const ( defaultLogMaxBackups = 15 // daily log files older than this will be automatically deleted defaultLogCompress = true // compress log files - defaultLogLocal = true // should log file *name* timestamps be server time? If false, will default to URC + defaultLogLocal = true // should log file *name* timestamps be server time? If false, will default to UTC defaultLogTSFormat = "2006-01-02 15:04:05" ) @@ -104,7 +104,7 @@ func NewLogger(name string, logPath string, debug bool) *Logger { } } -// NewChild creates a child logger that refer to the same logger as +// NewChild creates a child logger that refers to the same logger as // the parent. Also extend its name and add additional fields. func (l *Logger) NewChild(name string, fields ...interface{}) *Logger { return &Logger{ @@ -126,7 +126,7 @@ func (l *Logger) AddContexts(fields ...interface{}) *Logger { } } -// Clone creates an independent logger that get initialized with the +// Clone creates an independent logger that gets initialized with the // same logging level as the source logger. func (l *Logger) Clone(name string, fields ...interface{}) *Logger { lvl := zap.NewAtomicLevelAt(l.zapAtomicLevel.Level()) diff --git a/metrics.go b/metrics.go index f37f24a..db7e14e 100644 --- a/metrics.go +++ b/metrics.go @@ -34,6 +34,6 @@ func (c *MetricsCollector) CollectRuntimeMemStats() { // Emit collected metrics func (c *MetricsCollector) EmitMetrics() { - c.logger.Infof("Dummy emitt metrics...") + c.logger.Infof("Dummy emit metrics...") } From 645a0c92370f08848a65c68499a43f8692355fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Avic=20Simmons?= Date: Sat, 4 Jul 2026 15:00:33 -0400 Subject: [PATCH 2/2] docs: fix verb agreement in logger.go comment --- logger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger.go b/logger.go index d819cd7..ca7c3c9 100644 --- a/logger.go +++ b/logger.go @@ -1,7 +1,7 @@ // Package logger provides Logger which the rest of the project // should be using for all logging purposes. This logger essentially // embed zap's SugaredLogger for structured logging (use methods that -// ends in `w', e.g. Infow, Debugw). For documentation refer to +// end in `w', e.g. Infow, Debugw). For documentation refer to // https://pkg.go.dev/go.uber.org/zap?tab=doc#SugaredLogger. User // should set up log rotation when initializing this logger. //