mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
@@ -13,11 +13,7 @@
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/mitchellh/hashstructure"
|
||||
)
|
||||
import "github.com/gohugoio/hugo/helpers"
|
||||
|
||||
// ResourceTransformationKey are provided by the different transformation implementations.
|
||||
// It identifies the transformation (name) and its configuration (elements).
|
||||
@@ -42,23 +38,6 @@ func (k ResourceTransformationKey) Value() string {
|
||||
return k.Name
|
||||
}
|
||||
|
||||
return k.Name + "_" + HashString(k.elements...)
|
||||
return k.Name + "_" + helpers.HashString(k.elements...)
|
||||
|
||||
}
|
||||
|
||||
// HashString returns a hash from the given elements.
|
||||
// It will panic if the hash cannot be calculated.
|
||||
func HashString(elements ...interface{}) string {
|
||||
var o interface{}
|
||||
if len(elements) == 1 {
|
||||
o = elements[0]
|
||||
} else {
|
||||
o = elements
|
||||
}
|
||||
|
||||
hash, err := hashstructure.Hash(o, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return strconv.FormatUint(hash, 10)
|
||||
}
|
||||
|
Reference in New Issue
Block a user