From 394721eb04c5b216ed5fc8d9c265ab7eed7fd019 Mon Sep 17 00:00:00 2001 From: Erik Baranowski <39704712+erikbaranowski@users.noreply.github.com> Date: Thu, 7 Dec 2023 18:14:25 -0500 Subject: [PATCH] Fix windows tests 2 (#5932) --- component/loki/source/windowsevent/bookmark.go | 4 +++- docs/docs_updated_test.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 (