20 lines
364 B
Go
20 lines
364 B
Go
package fs
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/mitchellh/hashstructure/v2"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func DefaultGetPath[K comparable](key K) ([]string, error) {
|
|
uintHash, err := hashstructure.Hash(key, hashstructure.FormatV2, nil)
|
|
if err != nil {
|
|
return nil, errors.WithStack(err)
|
|
}
|
|
|
|
hash := strconv.FormatUint(uintHash, 16)
|
|
|
|
return []string{hash}, nil
|
|
}
|