From 04b89857e104ac7dcbf9fc65d8d4f1a1178123e6 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 16 Dec 2020 16:56:32 +0545 Subject: [PATCH] all: Fix minor typos --- benchSite.sh | 2 +- cache/filecache/filecache.go | 2 +- cache/namedmemcache/named_cache.go | 2 +- codegen/methods.go | 2 +- common/hugio/readers.go | 2 +- config/commonConfig.go | 2 +- helpers/path.go | 10 ++--- helpers/pathspec.go | 2 +- helpers/url.go | 4 +- hugofs/filter_fs.go | 2 +- hugofs/nosymlink_test.go | 2 +- hugofs/rootmapping_fs_test.go | 2 +- hugolib/breaking_changes_test.go | 8 ++-- hugolib/content_map.go | 8 ++-- hugolib/content_map_page.go | 2 +- hugolib/embedded_shortcodes_test.go | 2 +- hugolib/hugo_modules_test.go | 6 +-- hugolib/page.go | 6 +-- hugolib/page__common.go | 2 +- hugolib/pagebundler_test.go | 4 +- hugolib/pagecollections.go | 4 +- hugolib/pages_capture.go | 2 +- hugolib/paths/paths.go | 2 +- hugolib/site.go | 6 +-- hugolib/taxonomy_test.go | 8 ++-- hugolib/testhelpers_test.go | 4 +- langs/language.go | 2 +- markup/highlight/config.go | 2 +- media/mediaType.go | 4 +- minifiers/minifiers_test.go | 2 +- modules/collect.go | 2 +- parser/metadecoders/decoder.go | 2 +- parser/pageparser/pagelexer.go | 2 +- parser/pageparser/pagelexer_intro.go | 2 +- parser/pageparser/pagelexer_shortcode.go | 2 +- parser/pageparser/pageparser.go | 2 +- publisher/htmlElementsCollector.go | 2 +- releaser/releaser.go | 8 ++-- resources/image.go | 2 +- resources/image_cache.go | 2 +- resources/image_test.go | 2 +- .../page_generate/generate_page_wrappers.go | 8 ++-- resources/page/page_outputformat.go | 2 +- resources/page/pagegroup.go | 4 +- resources/page/pages.go | 2 +- resources/page/pages_prev_next.go | 2 +- resources/page/pages_related.go | 2 +- resources/resource.go | 4 +- resources/resource_spec.go | 2 +- resources/resource_test.go | 2 +- .../resource_transformers/babel/babel.go | 4 +- .../resource_transformers/minifier/minify.go | 2 +- .../resource_transformers/postcss/postcss.go | 4 +- resources/transform.go | 6 +-- source/fileInfo.go | 4 +- tpl/collections/collections_test.go | 4 +- tpl/collections/merge.go | 2 +- tpl/collections/sort_test.go | 2 +- tpl/compare/compare.go | 2 +- .../texttemplate/hugo_template.go | 2 +- tpl/math/math.go | 2 +- tpl/strings/strings.go | 2 +- tpl/template.go | 2 +- tpl/tplimpl/embedded/generate/generate.go | 4 +- tpl/urls/urls.go | 2 +- transform/chain_test.go | 2 +- transform/urlreplacers/absurlreplacer_test.go | 38 +++++++++---------- 67 files changed, 124 insertions(+), 124 deletions(-) diff --git a/benchSite.sh b/benchSite.sh index 623086708..aae21231c 100755 --- a/benchSite.sh +++ b/benchSite.sh @@ -3,7 +3,7 @@ # allow user to override go executable by running as GOEXE=xxx make ... GOEXE="${GOEXE-go}" -# Send in a regexp mathing the benchmarks you want to run, i.e. './benchSite.sh "YAML"'. +# Send in a regexp matching the benchmarks you want to run, i.e. './benchSite.sh "YAML"'. # Note the quotes, which will be needed for more complex expressions. # The above will run all variations, but only for front matter YAML. diff --git a/cache/filecache/filecache.go b/cache/filecache/filecache.go index c586f9a51..ffb0895b0 100644 --- a/cache/filecache/filecache.go +++ b/cache/filecache/filecache.go @@ -221,7 +221,7 @@ func (c *Cache) GetOrCreateBytes(id string, create func() ([]byte, error)) (Item return info, b, nil } -// GetBytes gets the file content with the given id from the cahce, nil if none found. +// GetBytes gets the file content with the given id from the cache, nil if none found. func (c *Cache) GetBytes(id string) (ItemInfo, []byte, error) { id = cleanID(id) diff --git a/cache/namedmemcache/named_cache.go b/cache/namedmemcache/named_cache.go index d67bcc28a..4e912bf58 100644 --- a/cache/namedmemcache/named_cache.go +++ b/cache/namedmemcache/named_cache.go @@ -54,7 +54,7 @@ func (c *Cache) Clear() { // GetOrCreate tries to get the value with the given cache key, if not found // create will be called and cached. // This method is thread safe. It also guarantees that the create func for a given -// key is invoced only once for this cache. +// key is invoked only once for this cache. func (c *Cache) GetOrCreate(key string, create func() (interface{}, error)) (interface{}, error) { c.mu.RLock() entry, found := c.cache[key] diff --git a/codegen/methods.go b/codegen/methods.go index 38477e333..23994c5f8 100644 --- a/codegen/methods.go +++ b/codegen/methods.go @@ -365,7 +365,7 @@ func (m Methods) Imports() []string { } // ToMarshalJSON creates a MarshalJSON method for these methods. Any method name -// matchin any of the regexps in excludes will be ignored. +// matching any of the regexps in excludes will be ignored. func (m Methods) ToMarshalJSON(receiver, pkgPath string, excludes ...string) (string, []string) { var sb strings.Builder diff --git a/common/hugio/readers.go b/common/hugio/readers.go index 8c901dd24..c93e05e86 100644 --- a/common/hugio/readers.go +++ b/common/hugio/readers.go @@ -32,7 +32,7 @@ type ReadSeekCloser interface { } // ReadSeekerNoOpCloser implements ReadSeekCloser by doing nothing in Close. -// TODO(bep) rename this and simila to ReadSeekerNopCloser, naming used in stdlib, which kind of makes sense. +// TODO(bep) rename this and similar to ReadSeekerNopCloser, naming used in stdlib, which kind of makes sense. type ReadSeekerNoOpCloser struct { ReadSeeker } diff --git a/config/commonConfig.go b/config/commonConfig.go index 260ebe73e..d0d24f8ff 100644 --- a/config/commonConfig.go +++ b/config/commonConfig.go @@ -34,7 +34,7 @@ var DefaultBuild = Build{ WriteStats: false, } -// Build holds some build related condfiguration. +// Build holds some build related configuration. type Build struct { UseResourceCacheWhen string // never, fallback, always. Default is fallback diff --git a/helpers/path.go b/helpers/path.go index abc73d081..17a513cec 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -128,7 +128,7 @@ func ishex(c rune) bool { // UnicodeSanitize sanitizes string to be used in Hugo URL's, allowing only // a predefined set of special Unicode characters. -// If RemovePathAccents configuration flag is enabled, Uniccode accents +// If RemovePathAccents configuration flag is enabled, Unicode accents // are also removed. // Spaces will be replaced with a single hyphen, and sequential hyphens will be reduced to one. func (p *PathSpec) UnicodeSanitize(s string) string { @@ -212,12 +212,12 @@ func GetDottedRelativePath(inPath string) string { return dottedPath } -// ExtNoDelimiter takes a path and returns the extension, excluding the delmiter, i.e. "md". +// ExtNoDelimiter takes a path and returns the extension, excluding the delimiter, i.e. "md". func ExtNoDelimiter(in string) string { return strings.TrimPrefix(Ext(in), ".") } -// Ext takes a path and returns the extension, including the delmiter, i.e. ".md". +// Ext takes a path and returns the extension, including the delimiter, i.e. ".md". func Ext(in string) string { _, ext := fileAndExt(in, fpb) return ext @@ -229,13 +229,13 @@ func PathAndExt(in string) (string, string) { } // FileAndExt takes a path and returns the file and extension separated, -// the extension including the delmiter, i.e. ".md". +// the extension including the delimiter, i.e. ".md". func FileAndExt(in string) (string, string) { return fileAndExt(in, fpb) } // FileAndExtNoDelimiter takes a path and returns the file and extension separated, -// the extension excluding the delmiter, e.g "md". +// the extension excluding the delimiter, e.g "md". func FileAndExtNoDelimiter(in string) (string, string) { file, ext := fileAndExt(in, fpb) return file, strings.TrimPrefix(ext, ".") diff --git a/helpers/pathspec.go b/helpers/pathspec.go index 5400249eb..49fd9a71c 100644 --- a/helpers/pathspec.go +++ b/helpers/pathspec.go @@ -37,7 +37,7 @@ type PathSpec struct { Cfg config.Provider } -// NewPathSpec creats a new PathSpec from the given filesystems and language. +// NewPathSpec creates a new PathSpec from the given filesystems and language. func NewPathSpec(fs *hugofs.Fs, cfg config.Provider, logger loggers.Logger) (*PathSpec, error) { return NewPathSpecWithBaseBaseFsProvided(fs, cfg, logger, nil) } diff --git a/helpers/url.go b/helpers/url.go index 6f4242b09..8c39bc4fa 100644 --- a/helpers/url.go +++ b/helpers/url.go @@ -105,7 +105,7 @@ func (p *PathSpec) URLize(uri string) string { return p.URLEscape(p.MakePathSanitized(uri)) } -// URLizeFilename creates an URL from a filename by esacaping unicode letters +// URLizeFilename creates an URL from a filename by escaping unicode letters // and turn any filepath separator into forward slashes. func (p *PathSpec) URLizeFilename(filename string) string { return p.URLEscape(filepath.ToSlash(filename)) @@ -280,7 +280,7 @@ func AddContextRoot(baseURL, relativePath string) string { newPath := path.Join(url.Path, relativePath) - // path strips traling slash, ignore root path. + // path strips trailing slash, ignore root path. if newPath != "/" && strings.HasSuffix(relativePath, "/") { newPath += "/" } diff --git a/hugofs/filter_fs.go b/hugofs/filter_fs.go index 8b0afd38d..279a28312 100644 --- a/hugofs/filter_fs.go +++ b/hugofs/filter_fs.go @@ -276,7 +276,7 @@ func (f *filterDir) Readdirnames(count int) ([]string, error) { } // Try to extract the language from the given filename. -// Any valid language identificator in the name will win over the +// Any valid language identifier in the name will win over the // language set on the file system, e.g. "mypost.en.md". func langInfoFrom(languages map[string]int, name string) (string, string, string) { var lang string diff --git a/hugofs/nosymlink_test.go b/hugofs/nosymlink_test.go index 99151ec67..e00dcf1a8 100644 --- a/hugofs/nosymlink_test.go +++ b/hugofs/nosymlink_test.go @@ -135,7 +135,7 @@ func TestNoSymlinkFs(t *testing.T) { // Check readdir f, err = fs.Open(workDir) c.Assert(err, qt.IsNil) - // There is at least one unsported symlink inside workDir + // There is at least one unsupported symlink inside workDir _, err = f.Readdir(-1) c.Assert(err, qt.IsNil) f.Close() diff --git a/hugofs/rootmapping_fs_test.go b/hugofs/rootmapping_fs_test.go index e5f68d7a9..fc2ddeb62 100644 --- a/hugofs/rootmapping_fs_test.go +++ b/hugofs/rootmapping_fs_test.go @@ -270,7 +270,7 @@ func TestRootMappingFsMount(t *testing.T) { c.Assert(err, qt.IsNil) c.Assert(string(b), qt.Equals, "some no content") - // Ambigous + // Ambiguous _, err = rfs.Stat(filepath.FromSlash("content/singles/p1.md")) c.Assert(err, qt.Not(qt.IsNil)) diff --git a/hugolib/breaking_changes_test.go b/hugolib/breaking_changes_test.go index a22bc240f..495baff3e 100644 --- a/hugolib/breaking_changes_test.go +++ b/hugolib/breaking_changes_test.go @@ -21,7 +21,7 @@ import ( ) func Test073(t *testing.T) { - asertDisabledTaxonomyAndTerm := func(b *sitesBuilder, taxonomy, term bool) { + assertDisabledTaxonomyAndTerm := func(b *sitesBuilder, taxonomy, term bool) { b.Assert(b.CheckExists("public/tags/index.html"), qt.Equals, taxonomy) b.Assert(b.CheckExists("public/tags/tag1/index.html"), qt.Equals, term) } @@ -88,7 +88,7 @@ taxonomy = ["JSON"] `disableKinds = ["taxonomy", "taxonomyTerm"]`, func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) - asertDisabledTaxonomyAndTerm(b, false, false) + assertDisabledTaxonomyAndTerm(b, false, false) }, }, { @@ -96,7 +96,7 @@ taxonomy = ["JSON"] `disableKinds = ["taxonomyTerm"]`, func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) - asertDisabledTaxonomyAndTerm(b, false, true) + assertDisabledTaxonomyAndTerm(b, false, true) }, }, { @@ -113,7 +113,7 @@ taxonomy = ["JSON"] ignoreErrors = ["error-disable-taxonomy"]`, func(err error, out string, b *sitesBuilder) { b.Assert(err, qt.IsNil) - asertDisabledTaxonomyAndTerm(b, false, true) + assertDisabledTaxonomyAndTerm(b, false, true) }, }, } { diff --git a/hugolib/content_map.go b/hugolib/content_map.go index ca2aa3672..3f5ed65c3 100644 --- a/hugolib/content_map.go +++ b/hugolib/content_map.go @@ -58,8 +58,8 @@ const ( cmLeafSeparator = "__hl_" ) -// Used to mark ambigous keys in reverse index lookups. -var ambigousContentNode = &contentNode{} +// Used to mark ambiguous keys in reverse index lookups. +var ambiguousContentNode = &contentNode{} func newContentMap(cfg contentMapConfig) *contentMap { m := &contentMap{ @@ -86,8 +86,8 @@ func newContentMap(cfg contentMapConfig) *contentMap { addToReverseMap := func(k string, n *contentNode, m map[interface{}]*contentNode) { k = strings.ToLower(k) existing, found := m[k] - if found && existing != ambigousContentNode { - m[k] = ambigousContentNode + if found && existing != ambiguousContentNode { + m[k] = ambiguousContentNode } else if !found { m[k] = n } diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 296363359..74dd0e029 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -232,7 +232,7 @@ func (m *pageMap) newResource(fim hugofs.FileMetaInfo, owner *pageState) (resour outputFormats := owner.m.outputFormats() seen := make(map[string]bool) var targetBasePaths []string - // Make sure bundled resources are published to all of the ouptput formats' + // Make sure bundled resources are published to all of the output formats' // sub paths. for _, f := range outputFormats { p := f.Path diff --git a/hugolib/embedded_shortcodes_test.go b/hugolib/embedded_shortcodes_test.go index 3ea1d8ab0..90f2685af 100644 --- a/hugolib/embedded_shortcodes_test.go +++ b/hugolib/embedded_shortcodes_test.go @@ -185,7 +185,7 @@ func TestShortcodeYoutube(t *testing.T) { `{{< youtube id="w7Ft2ymGmfc" class="video" autoplay="true" >}}`, "(?s)\n
.*?.*?
", }, - // set custom title for accessability) + // set custom title for accessibility) { `{{< youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" >}}`, "(?s)\n
.*?.*?
", diff --git a/hugolib/hugo_modules_test.go b/hugolib/hugo_modules_test.go index f63da5a07..4946d0f59 100644 --- a/hugolib/hugo_modules_test.go +++ b/hugolib/hugo_modules_test.go @@ -151,7 +151,7 @@ JS imported in module: | "devDependencies": { "postcss-cli": "7.8.0", "tailwindcss": "1.8.0" - + } }`) @@ -375,7 +375,7 @@ module github.com/gohugoio/tests/testHugoModules } func createChildModMatchers(m *mods.Md, ignoreVendor, vendored bool) []string { - // Child depdendencies are one behind. + // Child dependencies are one behind. expectMinorVersion := 3 if !ignoreVendor && vendored { @@ -1078,7 +1078,7 @@ workingDir=%q [[module.mounts]] source = %q target = "content" - + `, workDir, absContentDir) defer clean1() diff --git a/hugolib/page.go b/hugolib/page.go index 47aeb6e9a..6c177b687 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -584,7 +584,7 @@ type renderStringOpts struct { Markup string } -var defualtRenderStringOpts = renderStringOpts{ +var defaultRenderStringOpts = renderStringOpts{ Display: "inline", Markup: "", // Will inherit the page's value when not set. } @@ -595,7 +595,7 @@ func (p *pageState) RenderString(args ...interface{}) (template.HTML, error) { } var s string - opts := defualtRenderStringOpts + opts := defaultRenderStringOpts sidx := 1 if len(args) == 1 { @@ -978,7 +978,7 @@ func (p *pageState) shiftToOutputFormat(isRenderingSite bool, idx int) error { // // For pages that have a source file, it is returns the path to this file as an // absolute path rooted in this site's content dir. -// For pages that do not (sections witout content page etc.), it returns the +// For pages that do not (sections without content page etc.), it returns the // virtual path, consistent with where you would add a source file. func (p *pageState) sourceRef() string { if !p.File().IsZero() { diff --git a/hugolib/page__common.go b/hugolib/page__common.go index d1c7ba866..e718721f7 100644 --- a/hugolib/page__common.go +++ b/hugolib/page__common.go @@ -57,7 +57,7 @@ type pageCommon struct { bucket *pagesMapBucket treeRef *contentTreeRef - // Laziliy initialized dependencies. + // Lazily initialized dependencies. init *lazy.Init // All of these represents the common parts of a page.Page diff --git a/hugolib/pagebundler_test.go b/hugolib/pagebundler_test.go index 8f9459564..5589a3e32 100644 --- a/hugolib/pagebundler_test.go +++ b/hugolib/pagebundler_test.go @@ -302,7 +302,7 @@ func TestPageBundlerSiteMultilingual(t *testing.T) { // A bundle in a/b/index.en.md // a/b/index.en.md => OK // a/b/index => OK - // index.en.md => ambigous, but OK. + // index.en.md => ambiguous, but OK. // With bundles, the file name has little meaning, the folder it lives in does. So this should also work: // a/b // and probably also just b (aka "my-bundle") @@ -1250,7 +1250,7 @@ func TestBundleTransformMany(t *testing.T) { title: "Page" weight: %d --- - + `, i)) b.WithSourceFile(fmt.Sprintf("content/bundle%d/data.yaml", i), fmt.Sprintf(`data: v%d`, i)) b.WithSourceFile(fmt.Sprintf("content/bundle%d/data.json", i), fmt.Sprintf(`{ "data": "v%d" }`, i)) diff --git a/hugolib/pagecollections.go b/hugolib/pagecollections.go index c1c9ef88b..2e4287612 100644 --- a/hugolib/pagecollections.go +++ b/hugolib/pagecollections.go @@ -98,7 +98,7 @@ func newPageCollections(m *pageMap) *PageCollections { // This is an adapter func for the old API with Kind as first argument. // This is invoked when you do .Site.GetPage. We drop the Kind and fails -// if there are more than 2 arguments, which would be ambigous. +// if there are more than 2 arguments, which would be ambiguous. func (c *PageCollections) getPageOldVersion(ref ...string) (page.Page, error) { var refs []string for _, r := range ref { @@ -291,7 +291,7 @@ func (c *PageCollections) getContentNode(context page.Page, isReflink bool, ref getByName := func(s string) (*contentNode, error) { n := m.pageReverseIndex.Get(s) if n != nil { - if n == ambigousContentNode { + if n == ambiguousContentNode { return nil, fmt.Errorf("page reference %q is ambiguous", ref) } return n, nil diff --git a/hugolib/pages_capture.go b/hugolib/pages_capture.go index 98e9fda51..c7a42acdc 100644 --- a/hugolib/pages_capture.go +++ b/hugolib/pages_capture.go @@ -278,7 +278,7 @@ func (c *pagesCollector) addToBundle(info hugofs.FileMetaInfo, btyp bundleDirTyp if btyp == bundleBranch { // No special logic for branch bundles. // Every language needs its own _index.md file. - // Also, we only clone bundle headers for lonsesome, bundled, + // Also, we only clone bundle headers for lonesome, bundled, // content files. return c.handleFiles(info) } diff --git a/hugolib/paths/paths.go b/hugolib/paths/paths.go index 8af77b072..bcf01a969 100644 --- a/hugolib/paths/paths.go +++ b/hugolib/paths/paths.go @@ -268,7 +268,7 @@ func (p *Paths) RelPathify(filename string) string { return strings.TrimPrefix(strings.TrimPrefix(filename, p.WorkingDir), FilePathSeparator) } -// AbsPathify creates an absolute path if given a working dir and arelative path. +// AbsPathify creates an absolute path if given a working dir and a relative path. // If already absolute, the path is just cleaned. func AbsPathify(workingDir, inPath string) string { if filepath.IsAbs(inPath) { diff --git a/hugolib/site.go b/hugolib/site.go index 4175fecc2..d2a5e68ae 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -956,7 +956,7 @@ func (s *Site) translateFileEvents(events []fsnotify.Event) []fsnotify.Event { eventMap := make(map[string][]fsnotify.Event) // We often get a Remove etc. followed by a Create, a Create followed by a Write. - // Remove the superflous events to mage the update logic simpler. + // Remove the superfluous events to mage the update logic simpler. for _, ev := range events { eventMap[ev.Name] = append(eventMap[ev.Name], ev) } @@ -999,7 +999,7 @@ var ( ) // reBuild partially rebuilds a site given the filesystem events. -// It returns whetever the content source was changed. +// It returns whatever the content source was changed. // TODO(bep) clean up/rewrite this method. func (s *Site) processPartial(config *BuildCfg, init func(config *BuildCfg) error, events []fsnotify.Event) error { events = s.filterFileEvents(events) @@ -1513,7 +1513,7 @@ func (s *Site) assembleMenus() { } } -// get any lanaguagecode to prefix the target file path with. +// get any language code to prefix the target file path with. func (s *Site) getLanguageTargetPathLang(alwaysInSubDir bool) string { if s.h.IsMultihost() { return s.Language().Lang diff --git a/hugolib/taxonomy_test.go b/hugolib/taxonomy_test.go index dba4f4856..b26032174 100644 --- a/hugolib/taxonomy_test.go +++ b/hugolib/taxonomy_test.go @@ -316,7 +316,7 @@ categories: ["This is Cool", "And new" ] --- Content. - + `) } @@ -454,7 +454,7 @@ categories: ["funny"] `, "categories/_index.md", "---\ntitle: Categories Page\n---", "categories/data.json", "Category data", - "categories/funny/_index.md", "---\ntitle: Funnny Category\n---", + "categories/funny/_index.md", "---\ntitle: Funny Category\n---", "categories/funny/funnydata.json", "Category funny data", ) @@ -525,7 +525,7 @@ Funny:|/p2/|`) func TestTaxonomiesListPages(t *testing.T) { b := newTestSitesBuilder(t) b.WithTemplates("_default/list.html", ` - + {{ template "print-taxo" "categories.cats" }} {{ template "print-taxo" "categories.funny" }} @@ -560,7 +560,7 @@ categories: ["cats"] b.Build(BuildCfg{}) b.AssertFileContent("public/index.html", ` - + Len categories.cats: 2 categories.cats:|/blog/| categories.cats:|/| diff --git a/hugolib/testhelpers_test.go b/hugolib/testhelpers_test.go index 726930721..78d80bebf 100644 --- a/hugolib/testhelpers_test.go +++ b/hugolib/testhelpers_test.go @@ -928,13 +928,13 @@ func buildSingleSite(t testing.TB, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Sit return buildSingleSiteExpected(t, false, false, depsCfg, buildCfg) } -func buildSingleSiteExpected(t testing.TB, expectSiteInitEror, expectBuildError bool, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Site { +func buildSingleSiteExpected(t testing.TB, expectSiteInitError, expectBuildError bool, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Site { t.Helper() b := newTestSitesBuilderFromDepsCfg(t, depsCfg).WithNothingAdded() err := b.CreateSitesE() - if expectSiteInitEror { + if expectSiteInitError { b.Assert(err, qt.Not(qt.IsNil)) return nil } else { diff --git a/langs/language.go b/langs/language.go index 9fa22b05a..bdfde573c 100644 --- a/langs/language.go +++ b/langs/language.go @@ -126,7 +126,7 @@ func (l Languages) Less(i, j int) bool { func (l Languages) Swap(i, j int) { l[i], l[j] = l[j], l[i] } -// Params retunrs language-specific params merged with the global params. +// Params returns language-specific params merged with the global params. func (l *Language) Params() maps.Params { // TODO(bep) this construct should not be needed. Create the // language params in one go. diff --git a/markup/highlight/config.go b/markup/highlight/config.go index 1bee58dc5..1dc1e28e2 100644 --- a/markup/highlight/config.go +++ b/markup/highlight/config.go @@ -155,7 +155,7 @@ func parseOptions(in string) (map[string]interface{}, error) { return opts, nil } -// startLine compansates for https://github.com/alecthomas/chroma/issues/30 +// startLine compensates for https://github.com/alecthomas/chroma/issues/30 func hlLinesToRanges(startLine int, s string) ([][2]int, error) { var ranges [][2]int s = strings.TrimSpace(s) diff --git a/media/mediaType.go b/media/mediaType.go index 21d4ddca5..9e35212b2 100644 --- a/media/mediaType.go +++ b/media/mediaType.go @@ -40,7 +40,7 @@ type Type struct { SubType string `json:"subType"` // i.e. html // This is the optional suffix after the "+" in the MIME type, - // e.g. "xml" in "applicatiion/rss+xml". + // e.g. "xml" in "application/rss+xml". mimeSuffix string Delimiter string `json:"delimiter"` // e.g. "." @@ -107,7 +107,7 @@ func (m Type) FullSuffix() string { return m.Delimiter + m.Suffix() } -// Suffix returns the file suffix without any delmiter prepended. +// Suffix returns the file suffix without any delimiter prepended. func (m Type) Suffix() string { if m.fileSuffix != "" { return m.fileSuffix diff --git a/minifiers/minifiers_test.go b/minifiers/minifiers_test.go index c3922b06d..9e62c5d50 100644 --- a/minifiers/minifiers_test.go +++ b/minifiers/minifiers_test.go @@ -95,7 +95,7 @@ func TestConfigureMinify(t *testing.T) { }{ {media.HTMLType, " Hugo! ", " Hugo! ", false}, // configured minifier {media.CSSType, " body { color: blue; } ", "body{color:blue}", false}, // default minifier - {media.XMLType, " Hugo! ", "", true}, // disable Xml minificatin + {media.XMLType, " Hugo! ", "", true}, // disable Xml minification } { var b bytes.Buffer if !test.errorExpected { diff --git a/modules/collect.go b/modules/collect.go index 179b9d1fb..eb7e0d000 100644 --- a/modules/collect.go +++ b/modules/collect.go @@ -559,7 +559,7 @@ func (c *collector) mountCommonJSConfig(owner *moduleAdapter, mounts []Mount) ([ for _, m := range mounts { if strings.HasPrefix(m.Target, files.JsConfigFolderMountPrefix) { // This follows the convention of the other component types (assets, content, etc.), - // if one or more is specificed by the user, we skip the defaults. + // if one or more is specified by the user, we skip the defaults. // These mounts were added to Hugo in 0.75. return mounts, nil } diff --git a/parser/metadecoders/decoder.go b/parser/metadecoders/decoder.go index 7fc8330af..131d6f39b 100644 --- a/parser/metadecoders/decoder.go +++ b/parser/metadecoders/decoder.go @@ -105,7 +105,7 @@ func (d Decoder) UnmarshalStringTo(data string, typ interface{}) (interface{}, e case float64: return cast.ToFloat64E(data) default: - return nil, errors.Errorf("unmarshal: %T not supportedd", typ) + return nil, errors.Errorf("unmarshal: %T not supported", typ) } } diff --git a/parser/pageparser/pagelexer.go b/parser/pageparser/pagelexer.go index c360642c4..266fb50f5 100644 --- a/parser/pageparser/pagelexer.go +++ b/parser/pageparser/pagelexer.go @@ -426,7 +426,7 @@ func lexMainSection(l *pageLexer) stateFunc { } if l.isInHTMLComment { - return lexEndFromtMatterHTMLComment + return lexEndFrontMatterHTMLComment } // Fast forward as far as possible. diff --git a/parser/pageparser/pagelexer_intro.go b/parser/pageparser/pagelexer_intro.go index 961528ef2..6e4617998 100644 --- a/parser/pageparser/pagelexer_intro.go +++ b/parser/pageparser/pagelexer_intro.go @@ -56,7 +56,7 @@ LOOP: return lexMainSection } -func lexEndFromtMatterHTMLComment(l *pageLexer) stateFunc { +func lexEndFrontMatterHTMLComment(l *pageLexer) stateFunc { l.isInHTMLComment = false right := l.index(htmlCommentEnd) if right == -1 { diff --git a/parser/pageparser/pagelexer_shortcode.go b/parser/pageparser/pagelexer_shortcode.go index 774a8f690..5b4e0ae55 100644 --- a/parser/pageparser/pagelexer_shortcode.go +++ b/parser/pageparser/pagelexer_shortcode.go @@ -185,7 +185,7 @@ Loop: l.backup() break Loop } else if openQuoteFound { - // the coming quoute is inside + // the coming quote is inside escapedInnerQuoteFound = true escapedQuoteState = 1 } diff --git a/parser/pageparser/pageparser.go b/parser/pageparser/pageparser.go index 19d068ece..7bfcfd698 100644 --- a/parser/pageparser/pageparser.go +++ b/parser/pageparser/pageparser.go @@ -172,7 +172,7 @@ func (t *Iterator) PeekWalk(walkFn func(item Item) bool) { } } -// Consume is a convencience method to consume the next n tokens, +// Consume is a convenience method to consume the next n tokens, // but back off Errors and EOF. func (t *Iterator) Consume(cnt int) { for i := 0; i < cnt; i++ { diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go index 82846e3d0..ace5a78b4 100644 --- a/publisher/htmlElementsCollector.go +++ b/publisher/htmlElementsCollector.go @@ -140,7 +140,7 @@ func (w *cssClassCollectorWriter) Write(p []byte) (n int, err error) { return } -// The net/html parser does not handle single table elemnts as input, e.g. tbody. +// The net/html parser does not handle single table elements as input, e.g. tbody. // We only care about the element/class/ids, so just store away the original tag name // and pretend it's a
. func (c *cssClassCollectorWriter) insertStandinHTMLElement(el string) (string, string) { diff --git a/releaser/releaser.go b/releaser/releaser.go index 61b9d211f..97ffe1a2c 100644 --- a/releaser/releaser.go +++ b/releaser/releaser.go @@ -131,12 +131,12 @@ func (r *ReleaseHandler) Run() error { return err } - prepareRelaseNotes := isPatch || relNotesState == releaseNotesNone + prepareReleaseNotes := isPatch || relNotesState == releaseNotesNone shouldRelease := isPatch || relNotesState == releaseNotesReady defer r.gitPush() // TODO(bep) - if prepareRelaseNotes || shouldRelease { + if prepareReleaseNotes || shouldRelease { gitCommits, err = getGitInfos(changeLogFromTag, "hugo", "", !r.try) if err != nil { return err @@ -150,11 +150,11 @@ func (r *ReleaseHandler) Run() error { } if relNotesState == releaseNotesCreated { - fmt.Println("Release notes created, but not ready. Reneame to *-ready.md to continue ...") + fmt.Println("Release notes created, but not ready. Rename to *-ready.md to continue ...") return nil } - if prepareRelaseNotes { + if prepareReleaseNotes { releaseNotesFile, err := r.writeReleaseNotesToTemp(version, isPatch, gitCommits, gitCommitsDocs) if err != nil { return err diff --git a/resources/image.go b/resources/image.go index ac0a0cc97..ed303613f 100644 --- a/resources/image.go +++ b/resources/image.go @@ -152,7 +152,7 @@ func (i *imageResource) cloneWithUpdates(u *transformationUpdate) (baseResource, var img *images.Image - if u.isContenChanged() { + if u.isContentChanged() { img = i.WithSpec(base) } else { img = i.Image diff --git a/resources/image_cache.go b/resources/image_cache.go index 1888b457f..1bb92b6ca 100644 --- a/resources/image_cache.go +++ b/resources/image_cache.go @@ -46,7 +46,7 @@ func (c *imageCache) deleteIfContains(s string) { } } -// The cache key is a lowecase path with Unix style slashes and it always starts with +// The cache key is a lowercase path with Unix style slashes and it always starts with // a leading slash. func (c *imageCache) normalizeKey(key string) string { return "/" + c.normalizeKeyBase(key) diff --git a/resources/image_test.go b/resources/image_test.go index 542ecb9b9..9c1861960 100644 --- a/resources/image_test.go +++ b/resources/image_test.go @@ -354,7 +354,7 @@ func TestImageResizeInSubPath(t *testing.T) { assertImageFile(c, spec.BaseFs.PublishFs, publishedImageFilename, 101, 101) c.Assert(spec.BaseFs.PublishFs.Remove(publishedImageFilename), qt.IsNil) - // Cleare mem cache to simulate reading from the file cache. + // Clear mem cache to simulate reading from the file cache. spec.imageCache.clear() resizedAgain, err := image.Resize("101x101") diff --git a/resources/page/page_generate/generate_page_wrappers.go b/resources/page/page_generate/generate_page_wrappers.go index ff3744c20..e1d83115b 100644 --- a/resources/page/page_generate/generate_page_wrappers.go +++ b/resources/page/page_generate/generate_page_wrappers.go @@ -81,7 +81,7 @@ func generateMarshalJSON(c *codegen.Inspector) error { // Exclude these methods excludes := []reflect.Type{ - // We need to eveluate the deprecated vs JSON in the future, + // We need to evaluate the deprecated vs JSON in the future, // but leave them out for now. pageInterfaceDeprecated, @@ -146,7 +146,7 @@ func generateDeprecatedWrappers(c *codegen.Inspector) error { "Hugo": "Use the global hugo function.", "LanguagePrefix": "Use .Site.LanguagePrefix.", "GetParam": "Use .Param or .Params.myParam.", - "RSSLink": `Use the Output Format's link, e.g. something like: + "RSSLink": `Use the Output Format's link, e.g. something like: {{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}`, "URL": "Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url", } @@ -244,8 +244,8 @@ package page %s // ZeroFile represents a zero value of source.File with warnings if invoked. -type zeroFile struct { - log *helpers.DistinctLogger +type zeroFile struct { + log *helpers.DistinctLogger } func NewZeroFile(log *helpers.DistinctLogger) source.File { diff --git a/resources/page/page_outputformat.go b/resources/page/page_outputformat.go index ff4213cc4..9eed8241e 100644 --- a/resources/page/page_outputformat.go +++ b/resources/page/page_outputformat.go @@ -27,7 +27,7 @@ type OutputFormats []OutputFormat // OutputFormat links to a representation of a resource. type OutputFormat struct { - // Rel constains a value that can be used to construct a rel link. + // Rel contains a value that can be used to construct a rel link. // This is value is fetched from the output format definition. // Note that for pages with only one output format, // this method will always return "canonical". diff --git a/resources/page/pagegroup.go b/resources/page/pagegroup.go index 07ccbfedd..d4ca8ca41 100644 --- a/resources/page/pagegroup.go +++ b/resources/page/pagegroup.go @@ -343,7 +343,7 @@ func (p Pages) GroupByParamDate(key string, format string, order ...string) (Pag return p.groupByDateField(sorter, formatter, order...) } -// ProbablyEq wraps comare.ProbablyEqer +// ProbablyEq wraps compare.ProbablyEqer func (p PageGroup) ProbablyEq(other interface{}) bool { otherP, ok := other.(PageGroup) if !ok { @@ -387,7 +387,7 @@ func (psg PagesGroup) Len() int { return l } -// ProbablyEq wraps comare.ProbablyEqer +// ProbablyEq wraps compare.ProbablyEqer func (psg PagesGroup) ProbablyEq(other interface{}) bool { otherPsg, ok := other.(PagesGroup) if !ok { diff --git a/resources/page/pages.go b/resources/page/pages.go index ac69a8079..dff784f5c 100644 --- a/resources/page/pages.go +++ b/resources/page/pages.go @@ -104,7 +104,7 @@ func (p Pages) Len() int { return len(p) } -// ProbablyEq wraps comare.ProbablyEqer +// ProbablyEq wraps compare.ProbablyEqer func (pages Pages) ProbablyEq(other interface{}) bool { otherPages, ok := other.(Pages) if !ok { diff --git a/resources/page/pages_prev_next.go b/resources/page/pages_prev_next.go index f30a55da5..753a3e415 100644 --- a/resources/page/pages_prev_next.go +++ b/resources/page/pages_prev_next.go @@ -13,7 +13,7 @@ package page -// Next returns the next page reletive to the given +// Next returns the next page relative to the given func (p Pages) Next(cur Page) Page { x := searchPage(cur, p) if x <= 0 { diff --git a/resources/page/pages_related.go b/resources/page/pages_related.go index 026026572..bc3b8b55a 100644 --- a/resources/page/pages_related.go +++ b/resources/page/pages_related.go @@ -108,7 +108,7 @@ func (p Pages) withInvertedIndex(search func(idx *related.InvertedIndex) ([]rela d, ok := p[0].(InternalDependencies) if !ok { - return nil, errors.Errorf("invalid type %T in related serch", p[0]) + return nil, errors.Errorf("invalid type %T in related search", p[0]) } cache := d.GetRelatedDocsHandler() diff --git a/resources/resource.go b/resources/resource.go index 64f9f12f3..28b9a8879 100644 --- a/resources/resource.go +++ b/resources/resource.go @@ -440,7 +440,7 @@ func (l *genericResource) openDestinationsForWriting() (w io.WriteCloser, err er // Fast path: // This is a processed version of the original; - // check if it already existis at the destination. + // check if it already exists at the destination. for _, targetFilename := range targetFilenames { if _, err := l.getSpec().BaseFs.PublishFs.Stat(targetFilename); err == nil { continue @@ -662,7 +662,7 @@ type resourcePathDescriptor struct { targetPathBuilder func() page.TargetPaths // This will normally be the same as above, but this will only apply to publishing - // of resources. It may be mulltiple values when in multihost mode. + // of resources. It may be multiple values when in multihost mode. baseTargetPathDirs []string // baseOffset is set when the output format's path has a offset, e.g. for AMP. diff --git a/resources/resource_spec.go b/resources/resource_spec.go index 1659332ab..c29d2eaf9 100644 --- a/resources/resource_spec.go +++ b/resources/resource_spec.go @@ -274,7 +274,7 @@ func (r *Spec) newResource(sourceFs afero.Fs, fd ResourceSourceDescriptor) (reso ext := strings.ToLower(filepath.Ext(fd.RelTargetFilename)) mimeType, found := r.MediaTypes.GetFirstBySuffix(strings.TrimPrefix(ext, ".")) - // TODO(bep) we need to handle these ambigous types better, but in this context + // TODO(bep) we need to handle these ambiguous types better, but in this context // we most likely want the application/xml type. if mimeType.Suffix() == "xml" && mimeType.SubType == "rss" { mimeType, found = r.MediaTypes.GetByType("application/xml") diff --git a/resources/resource_test.go b/resources/resource_test.go index bf7a94529..f015cd6c9 100644 --- a/resources/resource_test.go +++ b/resources/resource_test.go @@ -41,7 +41,7 @@ func TestGenericResource(t *testing.T) { c.Assert(r.ResourceType(), qt.Equals, "css") } -func TestGenericResourceWithLinkFacory(t *testing.T) { +func TestGenericResourceWithLinkFactory(t *testing.T) { c := qt.New(t) spec := newTestResourceSpec(specDescriptor{c: c}) diff --git a/resources/resource_transformers/babel/babel.go b/resources/resource_transformers/babel/babel.go index a7598f820..64d8667bd 100644 --- a/resources/resource_transformers/babel/babel.go +++ b/resources/resource_transformers/babel/babel.go @@ -131,11 +131,11 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx configFile = filepath.Clean(configFile) - // We need an abolute filename to the config file. + // We need an absolute filename to the config file. if !filepath.IsAbs(configFile) { configFile = t.rs.BaseFs.ResolveJSConfigFile(configFile) if configFile == "" && t.options.Config != "" { - // Only fail if the user specificed config file is not found. + // Only fail if the user specified config file is not found. return errors.Errorf("babel config %q not found:", configFile) } } diff --git a/resources/resource_transformers/minifier/minify.go b/resources/resource_transformers/minifier/minify.go index 51a3f4047..972461e0e 100644 --- a/resources/resource_transformers/minifier/minify.go +++ b/resources/resource_transformers/minifier/minify.go @@ -20,7 +20,7 @@ import ( "github.com/gohugoio/hugo/resources/resource" ) -// Client for minification of Resource objects. Supported minfiers are: +// Client for minification of Resource objects. Supported minifiers are: // css, html, js, json, svg and xml. type Client struct { rs *resources.Spec diff --git a/resources/resource_transformers/postcss/postcss.go b/resources/resource_transformers/postcss/postcss.go index 8ba40ebd1..27864b0c5 100644 --- a/resources/resource_transformers/postcss/postcss.go +++ b/resources/resource_transformers/postcss/postcss.go @@ -166,11 +166,11 @@ func (t *postcssTransformation) Transform(ctx *resources.ResourceTransformationC configFile = filepath.Clean(configFile) - // We need an abolute filename to the config file. + // We need an absolute filename to the config file. if !filepath.IsAbs(configFile) { configFile = t.rs.BaseFs.ResolveJSConfigFile(configFile) if configFile == "" && t.options.Config != "" { - // Only fail if the user specificed config file is not found. + // Only fail if the user specified config file is not found. return errors.Errorf("postcss config %q not found:", configFile) } } diff --git a/resources/transform.go b/resources/transform.go index d995bb46b..a9ec84671 100644 --- a/resources/transform.go +++ b/resources/transform.go @@ -105,7 +105,7 @@ type ResourceTransformationCtx struct { // to be simple types, as it needs to be serialized to JSON and back. Data map[string]interface{} - // This is used to publis additional artifacts, e.g. source maps. + // This is used to publish additional artifacts, e.g. source maps. // We may improve this. OpenResourcePublisher func(relTargetPath string) (io.WriteCloser, error) } @@ -479,7 +479,7 @@ func (r *resourceAdapter) transform(publish, setContent bool) error { publishwriters = append(publishwriters, metaw) } - // Any transofrmations reading from From must also write to To. + // Any transformations reading from From must also write to To. // This means that if the target buffer is empty, we can just reuse // the original reader. if b, ok := tctx.To.(*bytes.Buffer); ok && b.Len() > 0 { @@ -587,7 +587,7 @@ type transformationUpdate struct { startCtx ResourceTransformationCtx } -func (u *transformationUpdate) isContenChanged() bool { +func (u *transformationUpdate) isContentChanged() bool { return u.content != nil || u.sourceFilename != nil } diff --git a/source/fileInfo.go b/source/fileInfo.go index 4e7866315..9e7e6df53 100644 --- a/source/fileInfo.go +++ b/source/fileInfo.go @@ -152,7 +152,7 @@ func (fi *FileInfo) LogicalName() string { return fi.name } func (fi *FileInfo) BaseFileName() string { return fi.baseName } // TranslationBaseName returns a file's translation base name without the -// language segement (ie. "page"). +// language segment (ie. "page"). func (fi *FileInfo) TranslationBaseName() string { return fi.translationBaseName } // ContentBaseName is a either TranslationBaseName or name of containing folder @@ -266,7 +266,7 @@ func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) { baseName := helpers.Filename(name) if translationBaseName == "" { - // This is usyally provided by the filesystem. But this FileInfo is also + // This is usually provided by the filesystem. But this FileInfo is also // created in a standalone context when doing "hugo new". This is // an approximate implementation, which is "good enough" in that case. fileLangExt := filepath.Ext(baseName) diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go index a75ec9d16..a9bf9a09b 100644 --- a/tpl/collections/collections_test.go +++ b/tpl/collections/collections_test.go @@ -673,7 +673,7 @@ func TestShuffleRandomising(t *testing.T) { // Note that this test can fail with false negative result if the shuffle // of the sequence happens to be the same as the original sequence. However - // the propability of the event is 10^-158 which is negligible. + // the probability of the event is 10^-158 which is negligible. seqLen := 100 rand.Seed(time.Now().UTC().UnixNano()) @@ -835,7 +835,7 @@ func TestUniq(t *testing.T) { // Structs {pagesVals{p3v, p2v, p3v, p2v}, pagesVals{p3v, p2v}, false}, - // not Comparable(), use hashstruscture + // not Comparable(), use hashstructure {[]map[string]int{ {"K1": 1}, {"K2": 2}, {"K1": 1}, {"K2": 1}, }, []map[string]int{ diff --git a/tpl/collections/merge.go b/tpl/collections/merge.go index de59de0af..43815560f 100644 --- a/tpl/collections/merge.go +++ b/tpl/collections/merge.go @@ -23,7 +23,7 @@ import ( "github.com/pkg/errors" ) -// Merge creates a copy of the final parameter and merges the preceeding +// Merge creates a copy of the final parameter and merges the preceding // parameters into it in reverse order. // Currently only maps are supported. Key handling is case insensitive. func (ns *Namespace) Merge(params ...interface{}) (interface{}, error) { diff --git a/tpl/collections/sort_test.go b/tpl/collections/sort_test.go index 4798b5090..aa05b1874 100644 --- a/tpl/collections/sort_test.go +++ b/tpl/collections/sort_test.go @@ -53,7 +53,7 @@ func TestSort(t *testing.T) { {[]int{1, 2, 3, 4, 5}, nil, "asc", []int{1, 2, 3, 4, 5}}, {[]int{5, 4, 3, 1, 2}, nil, "asc", []int{1, 2, 3, 4, 5}}, - // test sort key parameter is focibly set empty + // test sort key parameter is forcibly set empty {[]string{"class3", "class1", "class2"}, map[int]string{1: "a"}, "asc", []string{"class1", "class2", "class3"}}, // test map sorting by keys {map[string]int{"1": 10, "2": 20, "3": 30, "4": 40, "5": 50}, nil, "asc", []int{10, 20, 30, 40, 50}}, diff --git a/tpl/compare/compare.go b/tpl/compare/compare.go index 8ce572273..88b18f00c 100644 --- a/tpl/compare/compare.go +++ b/tpl/compare/compare.go @@ -43,7 +43,7 @@ type Namespace struct { func (*Namespace) Default(dflt interface{}, given ...interface{}) (interface{}, error) { // given is variadic because the following construct will not pass a piped // argument when the key is missing: {{ index . "key" | default "foo" }} - // The Go template will complain that we got 1 argument when we expectd 2. + // The Go template will complain that we got 1 argument when we expected 2. if len(given) == 0 { return dflt, nil diff --git a/tpl/internal/go_templates/texttemplate/hugo_template.go b/tpl/internal/go_templates/texttemplate/hugo_template.go index 7cd6df0fb..eed546e61 100644 --- a/tpl/internal/go_templates/texttemplate/hugo_template.go +++ b/tpl/internal/go_templates/texttemplate/hugo_template.go @@ -94,7 +94,7 @@ func (t *Template) executeWithState(state *state, value reflect.Value) (err erro return } -// Below are modifed structs etc. The changes are marked with "Added for Hugo." +// Below are modified structs etc. The changes are marked with "Added for Hugo." // state represents the state of an execution. It's not part of the // template so that multiple executions of the same template diff --git a/tpl/math/math.go b/tpl/math/math.go index 2b2497c3e..badc189c8 100644 --- a/tpl/math/math.go +++ b/tpl/math/math.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package math provides template functions for mathmatical operations. +// Package math provides template functions for mathematical operations. package math import ( diff --git a/tpl/strings/strings.go b/tpl/strings/strings.go index 60cb658ba..178d17bc0 100644 --- a/tpl/strings/strings.go +++ b/tpl/strings/strings.go @@ -43,7 +43,7 @@ type Namespace struct { deps *deps.Deps } -// CountRunes returns the number of runes in s, excluding whitepace. +// CountRunes returns the number of runes in s, excluding whitespace. func (ns *Namespace) CountRunes(s interface{}) (int, error) { ss, err := cast.ToStringE(s) if err != nil { diff --git a/tpl/template.go b/tpl/template.go index 73db9b3a6..0375b4a17 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -87,7 +87,7 @@ type TemplateParseFinder interface { TemplateFinder } -// TemplateDebugger prints some debug info to stdoud. +// TemplateDebugger prints some debug info to stdout. type TemplateDebugger interface { Debug() } diff --git a/tpl/tplimpl/embedded/generate/generate.go b/tpl/tplimpl/embedded/generate/generate.go index 3f7cc0257..09a253e29 100644 --- a/tpl/tplimpl/embedded/generate/generate.go +++ b/tpl/tplimpl/embedded/generate/generate.go @@ -27,7 +27,7 @@ import ( func main() { templateFolder := filepath.Join("..", "templates") - temlatePath := filepath.Join(".", templateFolder) + templatePath := filepath.Join(".", templateFolder) file, err := os.Create("../templates.autogen.go") if err != nil { @@ -37,7 +37,7 @@ func main() { var nameValues []string - err = filepath.Walk(temlatePath, func(path string, info os.FileInfo, err error) error { + err = filepath.Walk(templatePath, func(path string, info os.FileInfo, err error) error { if err != nil { return err } diff --git a/tpl/urls/urls.go b/tpl/urls/urls.go index 652256f44..1bba636ad 100644 --- a/tpl/urls/urls.go +++ b/tpl/urls/urls.go @@ -141,7 +141,7 @@ func (ns *Namespace) refArgsToMap(args interface{}) (map[string]interface{}, err return m, nil case []string: if len(v) == 0 || len(v) > 2 { - return nil, fmt.Errorf("invalid numer of arguments to ref") + return nil, fmt.Errorf("invalid number of arguments to ref") } // These where the options before we introduced the map type: s = v[0] diff --git a/transform/chain_test.go b/transform/chain_test.go index af3ae61d6..78b288e97 100644 --- a/transform/chain_test.go +++ b/transform/chain_test.go @@ -30,7 +30,7 @@ func TestChainZeroTransformers(t *testing.T) { } } -func TestChaingMultipleTransformers(t *testing.T) { +func TestChainingMultipleTransformers(t *testing.T) { f1 := func(ct FromTo) error { _, err := ct.To().Write(bytes.Replace(ct.From().Bytes(), []byte("f1"), []byte("f1r"), -1)) return err diff --git a/transform/urlreplacers/absurlreplacer_test.go b/transform/urlreplacers/absurlreplacer_test.go index f4aa8b8ae..f57716c0d 100644 --- a/transform/urlreplacers/absurlreplacer_test.go +++ b/transform/urlreplacers/absurlreplacer_test.go @@ -28,10 +28,10 @@ const ( h5JsContentSingleQuote = "" h5JsContentAbsURL = "" h5JsContentAbsURLSchemaless = "" - corectOutputSrcHrefSq = "" + correctOutputSrcHrefDq = "" + correctOutputSrcHrefSq = "" - h5XMLXontentAbsURL = "<p><a href="/foobar">foobar</a></p> <p>A video: <iframe src='/foo'></iframe></p>" + h5XMLContentAbsURL = "<p><a href="/foobar">foobar</a></p> <p>A video: <iframe src='/foo'></iframe></p>" correctOutputSrcHrefInXML = "<p><a href="http://base/foobar">foobar</a></p> <p>A video: <iframe src='http://base/foo'></iframe></p>" h5XMLContentGuarded = "<p><a href="//foobar">foobar</a></p> <p>A video: <iframe src='//foo'></iframe></p>" ) @@ -60,30 +60,30 @@ const ( srcsetXMLBasicCorrect = `Pre. "text"` srcsetXMLSingleQuote = `Pre. "text"` srcsetXMLSingleQuoteCorrect = `Pre. "text"` - srcsetVariations = `Pre. -Missing start quote: text src='/img/foo.jpg'> FOO. - + srcsetVariations = `Pre. +Missing start quote: text src='/img/foo.jpg'> FOO. + schemaless: schemaless2: text src='http://base/img/foo.jpg'> FOO. - + srcsetVariationsCorrect = `Pre. +Missing start quote: text src='http://base/img/foo.jpg'> FOO. + schemaless: schemaless2: