refactor: clarify GOOS detection (#39620)

Introduce `consts.IsWindows`, now it's clearer to see how Windows build works
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-10-06 08:22:36 +00:00
1 parent 052f660ba5
commit 1065f03454
16 files changed
+44 -37

No files matched your search

+3 -2
View File
@@ -5,10 +5,11 @@ package user
import (
"os/exec"
"runtime"
"strings"
"testing"
"gitea.dev/modules/consts"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -26,7 +27,7 @@ func TestCurrentUsername(t *testing.T) {
require.NotEmpty(t, user)
// Windows whoami is weird, so just skip remaining tests
if runtime.GOOS == "windows" {
if consts.IsWindows {
t.Skip("skipped test because of weird whoami on Windows")
}
whoami, err := getWhoamiOutput()