diff --git a/component/loki/source/windowsevent/bookmark.go b/component/loki/source/windowsevent/bookmark.go index bd42f2532ccd..1997427ce50b 100644 --- a/component/loki/source/windowsevent/bookmark.go +++ b/component/loki/source/windowsevent/bookmark.go @@ -8,11 +8,12 @@ package windowsevent import ( "bytes" "errors" - "github.com/natefinch/atomic" "io" "io/fs" "os" + "github.com/natefinch/atomic" + "github.com/grafana/loki/clients/pkg/promtail/targets/windows/win_eventlog" ) @@ -55,6 +56,7 @@ func newBookMark(path string) (*bookMark, error) { if err != nil { return nil, err } + defer file.Close() fileContent, err := io.ReadAll(file) if err != nil { return nil, err diff --git a/docs/docs_updated_test.go b/docs/docs_updated_test.go index 21e9081c9493..a3c17e98b393 100644 --- a/docs/docs_updated_test.go +++ b/docs/docs_updated_test.go @@ -1,3 +1,5 @@ +//go:build !windows + package docs import (