Skip to content

Commit

Permalink
all: Fix comments for exported functions and packages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored and bep committed May 18, 2023
1 parent 24e7d0c commit 610ceda
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion common/herrors/errors.go
Expand Up @@ -49,7 +49,7 @@ func Recover(args ...any) {
}
}

// Get the current goroutine id. Used only for debugging.
// GetGID the current goroutine id. Used only for debugging.
func GetGID() uint64 {
b := make([]byte, 64)
b = b[:runtime.Stack(b, false)]
Expand Down
2 changes: 1 addition & 1 deletion common/herrors/file_error.go
Expand Up @@ -35,7 +35,7 @@ import (
type FileError interface {
error

// ErroContext holds some context information about the error.
// ErrorContext holds some context information about the error.
ErrorContext() *ErrorContext

text.Positioner
Expand Down
4 changes: 2 additions & 2 deletions common/maps/params.go
Expand Up @@ -37,7 +37,7 @@ func (p Params) GetNested(indices ...string) any {
return v
}

// Set overwrites values in dst with values in src for common or new keys.
// SetParams overwrites values in dst with values in src for common or new keys.
// This is done recursively.
func SetParams(dst, src Params) {
for k, v := range src {
Expand Down Expand Up @@ -83,7 +83,7 @@ func MergeParamsWithStrategy(strategy string, dst, src Params) {
dst.merge(ParamsMergeStrategy(strategy), src)
}

// MergeParamsWithStrategy transfers values from src to dst for new keys using the merge encoded in dst.
// MergeParams transfers values from src to dst for new keys using the merge encoded in dst.
// This is done recursively.
func MergeParams(dst, src Params) {
ms, _ := dst.GetMergeStrategy()
Expand Down
2 changes: 1 addition & 1 deletion config/security/whitelist.go
Expand Up @@ -84,7 +84,7 @@ func NewWhitelist(patterns ...string) Whitelist {
return Whitelist{patterns: patternsr, patternsStrings: patternsStrings}
}

// Accepted reports whether name is whitelisted.
// Accept reports whether name is whitelisted.
func (w Whitelist) Accept(name string) bool {
if w.acceptNone {
return false
Expand Down
2 changes: 1 addition & 1 deletion deps/deps.go
Expand Up @@ -231,7 +231,7 @@ type globalErrHandler struct {
quit chan struct{}
}

// SendErr sends the error on a channel to be handled later.
// SendError sends the error on a channel to be handled later.
// This can be used in situations where returning and aborting the current
// operation isn't practical.
func (e *globalErrHandler) SendError(err error) {
Expand Down
2 changes: 1 addition & 1 deletion helpers/general.go
Expand Up @@ -117,7 +117,7 @@ func UniqueStringsReuse(s []string) []string {
return result
}

// UniqueStringsReuse returns a sorted slice with any duplicates removed.
// UniqueStringsSorted returns a sorted slice with any duplicates removed.
// It will modify the input slice.
func UniqueStringsSorted(s []string) []string {
if len(s) == 0 {
Expand Down
6 changes: 3 additions & 3 deletions hugofs/fs.go
Expand Up @@ -85,7 +85,7 @@ func NewFromOld(fs afero.Fs, cfg config.Provider) *Fs {
return newFs(fs, fs, workingDir, publishDir)
}

// NewFrom creates a new Fs based on the provided Afero Fss
// NewFromSourceAndDestination creates a new Fs based on the provided Afero Fss
// as the source and destination file systems.
func NewFromSourceAndDestination(source, destination afero.Fs, cfg config.Provider) *Fs {
workingDir, publishDir := getWorkingPublishDir(cfg)
Expand Down Expand Up @@ -178,7 +178,7 @@ func MakeReadableAndRemoveAllModulePkgDir(fs afero.Fs, dir string) (int, error)
return counter, fs.RemoveAll(dir)
}

// HasOsFs returns whether fs is an OsFs or if it fs wraps an OsFs.
// IsOsFs returns whether fs is an OsFs or if it fs wraps an OsFs.
// TODO(bep) make this nore robust.
func IsOsFs(fs afero.Fs) bool {
var isOsFs bool
Expand All @@ -202,7 +202,7 @@ type FilesystemsUnwrapper interface {
UnwrapFilesystems() []afero.Fs
}

// FilesystemsProvider returns the underlying filesystem.
// FilesystemUnwrapper returns the underlying filesystem.
type FilesystemUnwrapper interface {
UnwrapFilesystem() afero.Fs
}
Expand Down
2 changes: 1 addition & 1 deletion hugolib/page.go
Expand Up @@ -146,7 +146,7 @@ func (p *pageState) Eq(other any) bool {
return p == pp
}

// GetIdentify is for internal use.
// GetIdentity is for internal use.
func (p *pageState) GetIdentity() identity.Identity {
return identity.NewPathIdentity(files.ComponentFolderContent, filepath.FromSlash(p.Pathc()))
}
Expand Down
2 changes: 1 addition & 1 deletion hugolib/pagecollections.go
Expand Up @@ -57,7 +57,7 @@ func (c *PageCollections) AllPages() page.Pages {
return c.allPages.get()
}

// AllPages returns all regular pages for all languages.
// AllRegularPages returns all regular pages for all languages.
func (c *PageCollections) AllRegularPages() page.Pages {
return c.allRegularPages.get()
}
Expand Down
2 changes: 1 addition & 1 deletion identity/identity.go
Expand Up @@ -20,7 +20,7 @@ import (
"sync/atomic"
)

// NewIdentityManager creates a new Manager starting at id.
// NewManager creates a new Manager starting at id.
func NewManager(id Provider) Manager {
return &identityManager{
Provider: id,
Expand Down
2 changes: 1 addition & 1 deletion langs/i18n/translationProvider.go
Expand Up @@ -123,7 +123,7 @@ func addTranslationFile(bundle *i18n.Bundle, r source.File) error {
return nil
}

// Clone sets the language func for the new language.
// CloneResource sets the language func for the new language.
func (tp *TranslationProvider) CloneResource(dst, src *deps.Deps) error {
dst.Translate = tp.t.Func(dst.Conf.Language().Lang)
return nil
Expand Down
2 changes: 1 addition & 1 deletion lazy/init.go
Expand Up @@ -73,7 +73,7 @@ func (ini *Init) Branch(initFn func(context.Context) (any, error)) *Init {
return ini.add(true, initFn)
}

// BranchdWithTimeout is same as Branch, but with a timeout.
// BranchWithTimeout is same as Branch, but with a timeout.
func (ini *Init) BranchWithTimeout(timeout time.Duration, f func(ctx context.Context) (any, error)) *Init {
return ini.Branch(func(ctx context.Context) (any, error) {
return ini.withTimeout(ctx, timeout, f)
Expand Down
2 changes: 1 addition & 1 deletion markup/asciidocext/asciidocext_config/config.go
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package asciidoc_config holds asciidoc related configuration.
// Package asciidocext_config holds asciidoc related configuration.
package asciidocext_config

var (
Expand Down
2 changes: 1 addition & 1 deletion markup/converter/hooks/hooks.go
Expand Up @@ -121,7 +121,7 @@ type HeadingContext interface {

// HeadingRenderer describes a uniquely identifiable rendering hook.
type HeadingRenderer interface {
// Render writes the rendered content to w using the data in w.
// RenderHeading writes the rendered content to w using the data in w.
RenderHeading(cctx context.Context, w io.Writer, ctx HeadingContext) error
identity.Provider
}
Expand Down
2 changes: 1 addition & 1 deletion markup/goldmark/codeblocks/transform.go
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/yuin/goldmark/text"
)

// Kind is the kind of an Hugo code block.
// KindCodeBlock is the kind of an Hugo code block.
var KindCodeBlock = ast.NewNodeKind("HugoCodeBlock")

// Its raw contents are the plain text of the code block.
Expand Down
2 changes: 1 addition & 1 deletion markup/goldmark/goldmark_config/config.go
Expand Up @@ -20,7 +20,7 @@ const (
AutoHeadingIDTypeBlackfriday = "blackfriday"
)

// DefaultConfig holds the default Goldmark configuration.
// Default holds the default Goldmark configuration.
var Default = Config{
Extensions: Extensions{
Typographer: Typographer{
Expand Down
2 changes: 1 addition & 1 deletion markup/highlight/highlight.go
Expand Up @@ -148,7 +148,7 @@ func (h chromaHighlighter) IsDefaultCodeBlockRenderer() bool {

var id = identity.NewPathIdentity("chroma", "highlight")

// GetIdentify is for internal use.
// GetIdentity is for internal use.
func (h chromaHighlighter) GetIdentity() identity.Identity {
return id
}
Expand Down
2 changes: 1 addition & 1 deletion markup/internal/attributes/attributes.go
Expand Up @@ -199,7 +199,7 @@ func RenderASTAttributes(w hugio.FlexiWriter, attributes ...ast.Attribute) {
}
}

// Render writes the attributes to the given as attributes to an HTML element.
// RenderAttributes Render writes the attributes to the given as attributes to an HTML element.
// This is used for the default codeblock rendering.
// This performs HTML escaping of string attributes.
func RenderAttributes(w hugio.FlexiWriter, skipClass bool, attributes ...Attribute) {
Expand Down
2 changes: 1 addition & 1 deletion markup/tableofcontents/tableofcontents.go
Expand Up @@ -31,7 +31,7 @@ type Builder struct {
toc *Fragments
}

// Add adds the heading to the ToC.
// AddAt adds the heading to the ToC.
func (b *Builder) AddAt(h *Heading, row, level int) {
if b.toc == nil {
b.toc = &Fragments{}
Expand Down
4 changes: 2 additions & 2 deletions resources/page/page.go
Expand Up @@ -334,7 +334,7 @@ type PageWithoutContent interface {
// Used in change/dependency tracking.
identity.Provider

// Headings returns the headings for this page when a filter is set.
// HeadingsFiltered returns the headings for this page when a filter is set.
// This is currently only triggered with the Related content feature
// and the "fragments" type of index.
HeadingsFiltered(context.Context) tableofcontents.Headings
Expand Down Expand Up @@ -373,7 +373,7 @@ type RefProvider interface {
// RelRef returns a relative URL to a page.
RelRef(argsm map[string]any) (string, error)

// RefFrom is for internal use only.
// RelRefFrom is for internal use only.
RelRefFrom(argsm map[string]any, source any) (string, error)
}

Expand Down
6 changes: 3 additions & 3 deletions resources/page/site.go
Expand Up @@ -128,13 +128,13 @@ type Site interface {
// For internal use only.
GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error)

// BuildDraft is deprecated and will be removed in a future release.
// BuildDrafts is deprecated and will be removed in a future release.
BuildDrafts() bool

// IsMultilingual reports whether this site is configured with more than one language.
// IsMultiLingual reports whether this site is configured with more than one language.
IsMultiLingual() bool

// LanguagePrefi returns the language prefix for this site.
// LanguagePrefix returns the language prefix for this site.
LanguagePrefix() string
}

Expand Down
2 changes: 1 addition & 1 deletion resources/postpub/postpub.go
Expand Up @@ -55,7 +55,7 @@ func NewPostPublishResource(id int, r resource.Resource) PostPublishedResource {
}
}

// postPublishResource holds a Resource to be transformed post publishing.
// PostPublishResource holds a Resource to be transformed post publishing.
type PostPublishResource struct {
prefix string
delegate resource.Resource
Expand Down
2 changes: 1 addition & 1 deletion resources/resource_transformers/tocss/dartsass/client.go
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package godartsass integrates with the Dass Sass Embedded protocol to transpile
// Package dartsass integrates with the Dass Sass Embedded protocol to transpile
// SCSS/SASS.
package dartsass

Expand Down
2 changes: 1 addition & 1 deletion tpl/compare/compare.go
Expand Up @@ -197,7 +197,7 @@ func (n *Namespace) Le(first any, others ...any) bool {
return true
}

// Lt returns the boolean truth of arg1 < arg2 && arg1 < arg3 && arg1 < arg4.
// LtCollate returns the boolean truth of arg1 < arg2 && arg1 < arg3 && arg1 < arg4.
// The provided collator will be used for string comparisons.
// This is for internal use.
func (n *Namespace) LtCollate(collator *langs.Collator, first any, others ...any) bool {
Expand Down

0 comments on commit 610ceda

Please sign in to comment.