fix linting

This commit is contained in:
Christian Goll
2022-10-14 19:31:07 +02:00
parent 12efa0cc68
commit 21f7a1f8c3

View File

@@ -78,6 +78,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Fprint(w, fmtStr)
}
fileDesc, err := os.OpenFile(overlayFile, os.O_RDWR, os.FileMode(PermMode))
if err != nil {
wwlog.Warn("Could not open file for editing: %s", err)
}
defer fileDesc.Close()
_, _ = fileDesc.Seek(0, 0)
hasher := sha256.New()
@@ -96,6 +99,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Error("Problems getting checksum of file %s\n", err)
}
sum2 := hex.EncodeToString(hasher.Sum(nil))
fmt.Println("sum1,sum2", sum1, sum2)
if sum1 == sum2 && newFile {
wwlog.Verbose("New template %s wasn't modified, deleting it", overlayFile)
err = os.Remove(overlayFile)