Skip to content

Commit ccd1fc7

Browse files
⚙️ Fix linting (#492)
<!-- Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. SPDX-License-Identifier: Apache-2.0 --> ### Description Fix linting issue ### Test Coverage <!-- Please put an `x` in the correct box e.g. `[x]` to indicate the testing coverage of this change. --> - [ ] This change is covered by existing or additional automated tests. - [ ] Manual testing has been performed (and evidence provided) as automated testing was not feasible. - [x] Additional tests are not required for this change (e.g. documentation update). --------- Co-authored-by: Josh <josh.jennings@arm.com>
1 parent 678c3e6 commit ccd1fc7

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

changes/202408141345.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:gear: Fix linting issue

utils/git/git_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log"
7+
"os"
78
"path/filepath"
89
"testing"
910
"time"
@@ -33,8 +34,7 @@ var (
3334
validTreeEntries []object.TreeEntry
3435
)
3536

36-
// Clone the repository once and use it and the valid trees/blobs/entries in all the tests
37-
func TestMain(m *testing.M) {
37+
func run(m *testing.M) (code int) {
3838
fs := filesystem.NewFs(filesystem.StandardFS)
3939
destBase, err := fs.TempDirInTempDir("git-test")
4040
if err != nil {
@@ -110,7 +110,14 @@ func TestMain(m *testing.M) {
110110
validTag = tag
111111

112112
// Run the tests
113-
_ = m.Run()
113+
code = m.Run()
114+
return
115+
}
116+
117+
// Clone the repository once and use it and the valid trees/blobs/entries in all the tests
118+
func TestMain(m *testing.M) {
119+
code := run(m) // extract into function so that defers are called before os.Exit
120+
os.Exit(code)
114121
}
115122

116123
func TestHandleTreeEntry(t *testing.T) {

0 commit comments

Comments
 (0)