Skip to content

Commit f5bf363

Browse files
committed
Cleanup instead of defer in beego test
1 parent 98ebd98 commit f5bf363

File tree

1 file changed

+1
-1
lines changed
  • instrumentation/github.com/astaxie/beego/otelbeego/test

1 file changed

+1
-1
lines changed

instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func TestRender(t *testing.T) {
240240
// Create the view
241241
file, err := os.CreateTemp(dir, "*index.tpl")
242242
require.NoError(t, err)
243-
defer file.Close()
243+
t.Cleanup(func() { require.NoError(t, file.Close()) })
244244
_, err = file.WriteString(htmlStr)
245245
require.NoError(t, err)
246246
// Add path to view path

0 commit comments

Comments
 (0)