From 6ccab98bc5e23aa9f0ed4fcf28878915a3b79bac Mon Sep 17 00:00:00 2001 From: Stefano Arlandini Date: Mon, 21 Mar 2022 10:23:43 +0100 Subject: [PATCH] Fix CR issues --- key/generator/metadata.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/key/generator/metadata.go b/key/generator/metadata.go index e1f8bb11..9c129988 100644 --- a/key/generator/metadata.go +++ b/key/generator/metadata.go @@ -92,7 +92,7 @@ func (g *Metadata) parseTemplate() (*template.Template, error) { func checksumFunc(logger log.Logger) func(string) string { return func(p string) string { - return fmt.Sprintf("%x", getFileHash(p, logger)) + return fmt.Sprintf("%x", fileHash(p, logger)) } } @@ -108,7 +108,7 @@ func hashFilesFunc(logger log.Logger) func(...string) string { } for _, p := range paths { - readers = append(readers, bytes.NewReader(getFileHash(p, logger))) + readers = append(readers, bytes.NewReader(fileHash(p, logger))) } } @@ -129,7 +129,7 @@ func hashFilesFunc(logger log.Logger) func(...string) string { } } -func getFileHash(path string, logger log.Logger) []byte { +func fileHash(path string, logger log.Logger) []byte { path, err := filepath.Abs(filepath.Clean(path)) if err != nil { level.Error(logger).Log("cache key template/checksum could not find file") @@ -144,11 +144,11 @@ func getFileHash(path string, logger log.Logger) []byte { defer internal.CloseWithErrLogf(logger, f, "checksum close defer") - str, err := readerHasher(f) + h, err := readerHasher(f) if err != nil { level.Error(logger).Log("cache key template/checksum could not generate hash") return []byte{} } - return str + return h }