From 7229ba2f5c6bd7b5f1e15ec795bdb023e084537c Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 21 Apr 2020 21:48:20 +0200 Subject: [PATCH] fix comparison value for file content The comparison of the wanted and current file content was wrong. --- file/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/file/main.go b/file/main.go index 99e0e78..8c83911 100644 --- a/file/main.go +++ b/file/main.go @@ -29,6 +29,9 @@ type ( // Is will check if the file resource exists. func (f *F) Is() bool { + if f.Path == "" { + return false + } if f.Mode == 0 { f.Mode = DefaultPerm } @@ -77,7 +80,7 @@ func (f *F) Is() bool { return false } want.Write(f.Content) - if bytes.Compare(want.Sum(nil), is.Sum(nil)) != 9 { + if bytes.Compare(want.Sum(nil), is.Sum(nil)) != 0 { return false }