summaryrefslogtreecommitdiffstats
path: root/helpers/processing_stats.go
diff options
context:
space:
mode:
authorCameron Moore <moorereason@gmail.com>2018-09-06 13:34:29 -0500
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-09-07 08:25:51 +0200
commitc8ce65046dc7539f3bf5f6dd35fa7ece2bec866d (patch)
tree5ad66c0ddc6db67a65f386fbdd0b4bfdb0fb6871 /helpers/processing_stats.go
parenta53f962312e273cea9fe460b40655350a82210f2 (diff)
helpers: Fix golint issues
helpers/general.go:448:1: comment on exported function DiffStrings should be of the form "DiffStrings ..." helpers/hugo.go:42:6: exported type HugoVersionString should have comment or be unexported helpers/hugo.go:48:1: exported method HugoVersion.Version should have comment or be unexported helpers/hugo.go:56:1: comment on exported method HugoVersionString.Compare should be of the form "Compare ..." helpers/hugo.go:62:1: comment on exported method HugoVersionString.Eq should be of the form "Eq ..." helpers/path.go:548:1: comment on exported function OpenFilesForWriting should be of the form "OpenFilesForWriting ..." helpers/processing_stats.go:24:6: exported type ProcessingStats should have comment or be unexported helpers/processing_stats.go:55:1: exported function NewProcessingStats should have comment or be unexported helpers/processing_stats.go:59:1: exported method ProcessingStats.Incr should have comment or be unexported helpers/processing_stats.go:63:1: exported method ProcessingStats.Add should have comment or be unexported helpers/processing_stats.go:67:1: exported method ProcessingStats.Table should have comment or be unexported helpers/processing_stats.go:83:1: exported function ProcessingStatsTable should have comment or be unexported
Diffstat (limited to 'helpers/processing_stats.go')
-rw-r--r--helpers/processing_stats.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/helpers/processing_stats.go b/helpers/processing_stats.go
index 2d7fcb4de..4382d5fa5 100644
--- a/helpers/processing_stats.go
+++ b/helpers/processing_stats.go
@@ -21,6 +21,7 @@ import (
"github.com/olekukonko/tablewriter"
)
+// ProcessingStats represents statistics about a site build.
type ProcessingStats struct {
Name string
@@ -52,18 +53,23 @@ func (s *ProcessingStats) toVals() []processingStatsTitleVal {
}
}
+// NewProcessingStats returns a new ProcessingStats instance.
func NewProcessingStats(name string) *ProcessingStats {
return &ProcessingStats{Name: name}
}
+// Incr increments a given counter.
func (s *ProcessingStats) Incr(counter *uint64) {
atomic.AddUint64(counter, 1)
}
+// Add adds an amount to a given counter.
func (s *ProcessingStats) Add(counter *uint64, amount int) {
atomic.AddUint64(counter, uint64(amount))
}
+// Table writes a table-formatted representation of the stats in a
+// ProcessingStats instance to w.
func (s *ProcessingStats) Table(w io.Writer) {
titleVals := s.toVals()
data := make([][]string, len(titleVals))
@@ -80,6 +86,7 @@ func (s *ProcessingStats) Table(w io.Writer) {
}
+// ProcessingStatsTable writes a table-formatted representation of stats to w.
func ProcessingStatsTable(w io.Writer, stats ...*ProcessingStats) {
names := make([]string, len(stats)+1)