diff options
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/page__meta.go | 6 | ||||
-rw-r--r-- | hugolib/page_test.go | 6 | ||||
-rw-r--r-- | hugolib/pagebundler_test.go | 7 | ||||
-rw-r--r-- | hugolib/pagesfromdata/pagesfromgotmpl.go | 3 | ||||
-rw-r--r-- | hugolib/resource_chain_test.go | 4 |
5 files changed, 13 insertions, 13 deletions
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go index fbc1a8aa1..b23084a47 100644 --- a/hugolib/page__meta.go +++ b/hugolib/page__meta.go @@ -22,7 +22,6 @@ import ( "time" "github.com/gobuffalo/flect" - "github.com/gohugoio/hugo/identity" "github.com/gohugoio/hugo/langs" "github.com/gohugoio/hugo/markup/converter" xmaps "golang.org/x/exp/maps" @@ -32,6 +31,7 @@ import ( "github.com/gohugoio/hugo/source" "github.com/gohugoio/hugo/common/constants" + "github.com/gohugoio/hugo/common/hashing" "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/maps" @@ -328,7 +328,7 @@ func (ps *pageState) setMetaPost(cascade map[page.PageMatcher]maps.Params) error ps.m.setMetaPostCount++ var cascadeHashPre uint64 if ps.m.setMetaPostCount > 1 { - cascadeHashPre = identity.HashUint64(ps.m.pageConfig.CascadeCompiled) + cascadeHashPre = hashing.HashUint64(ps.m.pageConfig.CascadeCompiled) ps.m.pageConfig.CascadeCompiled = xmaps.Clone[map[page.PageMatcher]maps.Params](ps.m.cascadeOriginal) } @@ -360,7 +360,7 @@ func (ps *pageState) setMetaPost(cascade map[page.PageMatcher]maps.Params) error } if ps.m.setMetaPostCount > 1 { - ps.m.setMetaPostCascadeChanged = cascadeHashPre != identity.HashUint64(ps.m.pageConfig.CascadeCompiled) + ps.m.setMetaPostCascadeChanged = cascadeHashPre != hashing.HashUint64(ps.m.pageConfig.CascadeCompiled) if !ps.m.setMetaPostCascadeChanged { // No changes, restore any value that may be changed by aggregation. diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 8919c246c..a1eb43430 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -23,13 +23,13 @@ import ( "time" "github.com/bep/clocks" - "github.com/gohugoio/hugo/identity" "github.com/gohugoio/hugo/markup/asciidocext" "github.com/gohugoio/hugo/markup/rst" "github.com/gohugoio/hugo/tpl" "github.com/gohugoio/hugo/config" + "github.com/gohugoio/hugo/common/hashing" "github.com/gohugoio/hugo/common/htime" "github.com/gohugoio/hugo/common/loggers" @@ -2040,8 +2040,8 @@ title: "p2" b.Assert(p1, qt.Not(qt.Equals), p2) - b.Assert(identity.HashString(p1), qt.Not(qt.Equals), identity.HashString(p2)) - b.Assert(identity.HashString(sites[0]), qt.Not(qt.Equals), identity.HashString(sites[1])) + b.Assert(hashing.HashString(p1), qt.Not(qt.Equals), hashing.HashString(p2)) + b.Assert(hashing.HashString(sites[0]), qt.Not(qt.Equals), hashing.HashString(sites[1])) } // Issue #11243 diff --git a/hugolib/pagebundler_test.go b/hugolib/pagebundler_test.go index 302201a1f..e4da75a72 100644 --- a/hugolib/pagebundler_test.go +++ b/hugolib/pagebundler_test.go @@ -19,12 +19,11 @@ import ( "path/filepath" "testing" + "github.com/gohugoio/hugo/common/hashing" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/config" - "github.com/gohugoio/hugo/helpers" - "github.com/gohugoio/hugo/hugofs" "github.com/gohugoio/hugo/resources/kinds" @@ -701,13 +700,13 @@ bundle min min key: {{ $jsonMinMin.Key }} b.AssertFileContent(index, fmt.Sprintf("data content unmarshaled: v%d", i)) b.AssertFileContent(index, fmt.Sprintf("data assets content unmarshaled: v%d", i)) - md5Asset := helpers.MD5String(fmt.Sprintf(`vdata: v%d`, i)) + md5Asset := hashing.MD5FromStringHexEncoded(fmt.Sprintf(`vdata: v%d`, i)) b.AssertFileContent(index, fmt.Sprintf("assets fingerprinted: /data%d/data.%s.yaml", i, md5Asset)) // The original is not used, make sure it's not published. b.Assert(b.CheckExists(fmt.Sprintf("public/data%d/data.yaml", i)), qt.Equals, false) - md5Bundle := helpers.MD5String(fmt.Sprintf(`data: v%d`, i)) + md5Bundle := hashing.MD5FromStringHexEncoded(fmt.Sprintf(`data: v%d`, i)) b.AssertFileContent(index, fmt.Sprintf("bundle fingerprinted: /bundle%d/data.%s.yaml", i, md5Bundle)) b.AssertFileContent(index, diff --git a/hugolib/pagesfromdata/pagesfromgotmpl.go b/hugolib/pagesfromdata/pagesfromgotmpl.go index 4107f9e33..fd7213bd9 100644 --- a/hugolib/pagesfromdata/pagesfromgotmpl.go +++ b/hugolib/pagesfromdata/pagesfromgotmpl.go @@ -19,6 +19,7 @@ import ( "io" "path/filepath" + "github.com/gohugoio/hugo/common/hashing" "github.com/gohugoio/hugo/common/maps" "github.com/gohugoio/hugo/common/paths" "github.com/gohugoio/hugo/helpers" @@ -219,7 +220,7 @@ type BuildState struct { } func (b *BuildState) hash(v any) uint64 { - return identity.HashUint64(v) + return hashing.HashUint64(v) } func (b *BuildState) checkHasChangedAndSetSourceInfo(changedPath string, v any) bool { diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go index 1365db72c..fa25a2768 100644 --- a/hugolib/resource_chain_test.go +++ b/hugolib/resource_chain_test.go @@ -27,8 +27,8 @@ import ( qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/common/hashing" "github.com/gohugoio/hugo/common/loggers" - "github.com/gohugoio/hugo/identity" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss" ) @@ -119,7 +119,7 @@ FAILED REMOTE ERROR DETAILS CONTENT: |failed to fetch remote resource: Not Imple |StatusCode: 501|ContentLength: 16|ContentType: text/plain; charset=utf-8| -`, identity.HashString(ts.URL+"/sunset.jpg", map[string]any{}))) +`, hashing.HashString(ts.URL+"/sunset.jpg", map[string]any{}))) b.AssertFileContent("public/styles.min.a1df58687c3c9cc38bf26532f7b4b2f2c2b0315dcde212376959995c04f11fef.css", "body{background-color:#add8e6}") b.AssertFileContent("public//styles2.min.1cfc52986836405d37f9998a63fd6dd8608e8c410e5e3db1daaa30f78bc273ba.css", "body{background-color:orange}") |