Skip to content

Commit 279544c

Browse files
committed
enable usetesting.os-temp-dir
1 parent 470393e commit 279544c

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ linters-settings:
102102
desc: do not use the ini package, use gitea's config system instead
103103
- pkg: gitea.com/go-chi/cache
104104
desc: do not use the go-chi cache package, use gitea's cache system
105+
usetesting:
106+
os-temp-dir: true
105107

106108
issues:
107109
max-issues-per-linter: 0

modules/storage/local_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
package storage
55

66
import (
7-
"os"
8-
"path/filepath"
97
"testing"
108

119
"code.gitea.io/gitea/modules/setting"
@@ -56,6 +54,5 @@ func TestBuildLocalPath(t *testing.T) {
5654
}
5755

5856
func TestLocalStorageIterator(t *testing.T) {
59-
dir := filepath.Join(os.TempDir(), "TestLocalStorageIteratorTestDir")
60-
testStorageIterator(t, setting.LocalStorageType, &setting.Storage{Path: dir})
57+
testStorageIterator(t, setting.LocalStorageType, &setting.Storage{Path: t.TempDir()})
6158
}

modules/util/legacy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
func TestCopyFile(t *testing.T) {
1818
testContent := []byte("hello")
1919

20-
tmpDir := os.TempDir()
20+
tmpDir := t.TempDir()
2121
now := time.Now()
2222
srcFile := fmt.Sprintf("%s/copy-test-%d-src.txt", tmpDir, now.UnixMicro())
2323
dstFile := fmt.Sprintf("%s/copy-test-%d-dst.txt", tmpDir, now.UnixMicro())

0 commit comments

Comments
 (0)