modify proxy handler

This commit is contained in:
2025-11-17 12:21:35 +08:00
parent 760e4a9b03
commit abfa51f12e
19 changed files with 755 additions and 52 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
"os"
"path/filepath"
"runtime"
"testing"
@@ -10,8 +11,20 @@ var repoRoot string
func init() {
_, file, _, ok := runtime.Caller(0)
if ok {
repoRoot = filepath.Join(filepath.Dir(file), "..", "..")
if !ok {
return
}
dir := filepath.Dir(file)
for {
if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil {
repoRoot = dir
return
}
parent := filepath.Dir(dir)
if parent == dir {
return
}
dir = parent
}
}