docs & feat: add license & attribution notice (Apache-2.0 / GPL-3.0) and core system enhancements

This commit is contained in:
CAtlas0784 committed 2026-11-01 20:14:36 +07:00
1 parent 507836d367
commit ce6aabfc55
47 files changed
+5674 -724

No files matched your search

+17 -3
View File
@@ -2,12 +2,15 @@ package gameserver
import (
"fmt"
"gac-hkrpg-go/internal/testutil"
"os"
"path/filepath"
"runtime"
"testing"
)
var testWorkspaceRoot string
func TestMain(m *testing.M) {
_, source, _, ok := runtime.Caller(0)
if !ok {
@@ -15,11 +18,22 @@ func TestMain(m *testing.M) {
os.Exit(2)
}
root := filepath.Clean(filepath.Join(filepath.Dir(source), "..", ".."))
if err := os.Chdir(root); err != nil {
temporary, err := os.MkdirTemp("", "gac-gameserver-tests-")
if err != nil {
panic(err)
}
if err := testutil.CopyRuntime(root, temporary); err != nil {
panic(err)
}
testWorkspaceRoot = temporary
if err := os.Chdir(temporary); err != nil {
fmt.Fprintf(os.Stderr, "cannot change to repository root %s: %v\n", root, err)
os.Exit(2)
}
os.Exit(m.Run())
code := m.Run()
_ = os.Chdir(root)
_ = os.RemoveAll(temporary)
os.Exit(code)
}
func chdirRepositoryRoot(t *testing.T) {
@@ -32,5 +46,5 @@ func chdirRepositoryRoot(t *testing.T) {
if _, err := os.Stat(filepath.Join(root, "go.mod")); err != nil {
t.Fatalf("cannot locate repository root from %s: %v", source, err)
}
t.Chdir(root)
t.Chdir(testWorkspaceRoot)
}