helpers: Fix golint issues
authorCameron Moore <moorereason@gmail.com>
Thu, 6 Sep 2018 18:34:29 +0000 (13:34 -0500)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 7 Sep 2018 06:25:51 +0000 (08:25 +0200)
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

helpers/general.go
helpers/hugo.go
helpers/path.go
helpers/processing_stats.go

index ab66376c32c28273bd79fff738c68deee68117ed..43a921318bb5c79e4440940185126545509634e4 100644 (file)
@@ -445,7 +445,7 @@ func DiffStringSlices(slice1 []string, slice2 []string) []string {
        return diffStr
 }
 
-// DiffString splits the strings into fields and runs it into DiffStringSlices.
+// DiffStrings splits the strings into fields and runs it into DiffStringSlices.
 // Useful for tests.
 func DiffStrings(s1, s2 string) []string {
        return DiffStringSlices(strings.Fields(s1), strings.Fields(s2))
index 4ec340e189574264c4ecc1fdce2a1c6efe6ce26c..45c261fd04bb8e569b79a083c583d697006eed50 100644 (file)
@@ -39,27 +39,29 @@ var (
        _ compare.Comparer = (*HugoVersionString)(nil)
 )
 
-type HugoVersionString string
-
 func (v HugoVersion) String() string {
        return hugoVersion(v.Number, v.PatchLevel, v.Suffix)
 }
 
+// Version returns the Hugo version.
 func (v HugoVersion) Version() HugoVersionString {
        return HugoVersionString(v.String())
 }
 
+// HugoVersionString represents a Hugo version string.
+type HugoVersionString string
+
 func (h HugoVersionString) String() string {
        return string(h)
 }
 
-// Implements compare.Comparer
+// Compare implements the compare.Comparer interface.
 func (h HugoVersionString) Compare(other interface{}) int {
        v := MustParseHugoVersion(h.String())
        return compareVersionsWithSuffix(v.Number, v.PatchLevel, v.Suffix, other)
 }
 
-// Implements compare.Eqer
+// Eq implements the compare.Eqer interface.
 func (h HugoVersionString) Eq(other interface{}) bool {
        s, err := cast.ToStringE(other)
        if err != nil {
index 9fef06d2a5b9ca90c78c8446e859aac3db35a428..1549df40429294ed6c24e4870c0e6e5c1e687c8d 100644 (file)
@@ -545,7 +545,7 @@ func WriteToDisk(inpath string, r io.Reader, fs afero.Fs) (err error) {
        return afero.WriteReader(fs, inpath, r)
 }
 
-// OpenFileForWriting opens all the given filenames for writing.
+// OpenFilesForWriting opens all the given filenames for writing.
 func OpenFilesForWriting(fs afero.Fs, filenames ...string) (io.WriteCloser, error) {
        var writeClosers []io.WriteCloser
        for _, filename := range filenames {
index 2d7fcb4de681d8a65b4c178f17d6451c1e27de03..4382d5fa5ccf48b9f2a43780d7f1aa49bd01fcec 100644 (file)
@@ -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)