@@ -14,39 +14,6 @@ func TestScripts(t *testing.T) {
1414 t .Skip ("Skipping testscript tests: GITHUB_TOKEN environment variable not set" )
1515 }
1616
17- // --- Determine Module Path (Needed for explicit build) ---
18- // This is a bit heuristic, find go.mod upwards from test execution dir
19- // modulePath := ""
20- // currentDir, err := os.Getwd()
21- // if err != nil {
22- // t.Fatalf("Setup: Cannot get current directory: %v", err)
23- // }
24- // dir := currentDir
25- // for {
26- // if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil {
27- // // Found go.mod, now read the module line (simplified parsing)
28- // modBytes, readErr := os.ReadFile(filepath.Join(dir, "go.mod"))
29- // if readErr != nil {
30- // t.Fatalf("Setup: Failed to read go.mod in %s: %v", dir, readErr)
31- // }
32- // lines := strings.SplitN(string(modBytes), "\n", 2) // Read first line
33- // if strings.HasPrefix(lines[0], "module ") {
34- // modulePath = strings.TrimSpace(strings.TrimPrefix(lines[0], "module "))
35- // }
36- // if modulePath == "" {
37- // t.Fatalf("Setup: Could not parse module path from go.mod in %s", dir)
38- // }
39- // break // Found it
40- // }
41- // parent := filepath.Dir(dir)
42- // if parent == dir { // Reached root directory
43- // t.Fatalf("Setup: Could not find go.mod upwards from %s", currentDir)
44- // }
45- // dir = parent
46- // }
47- // t.Logf("Setup: Determined module path: %s", modulePath)
48- // // --- End Determine Module Path ---
49-
5017 testscript .Run (t , testscript.Params {
5118 Dir : "../testdata/script" ,
5219 UpdateScripts : false ,
@@ -57,50 +24,6 @@ func TestScripts(t *testing.T) {
5724 env .Vars = append (env .Vars , "GOCOVERDIR=" + gocoverdir )
5825 }
5926
60- // // 2. Build the actual main application binary using its module path
61- // outputBinaryPath := filepath.Join(env.WorkDir, "actlock")
62- //
63- // goos := os.Getenv("GOOS")
64- // if goos == "" {
65- // goos = runtime.GOOS
66- // }
67- // goarch := os.Getenv("GOARCH")
68- // if goarch == "" {
69- // goarch = runtime.GOARCH
70- // }
71- // fmt.Printf("Setup: Building %s for GOOS=%s GOARCH=%s\n", modulePath, goos, goarch)
72- //
73- // // Build using the explicit module path, no need for cmd.Dir anymore
74- // cmd := exec.Command("go", "build", "-o", outputBinaryPath, modulePath)
75- //
76- // // Ensure build runs with appropriate env if needed (e.g., CGO_ENABLED=0)
77- // cmd.Env = append(os.Environ(), "CGO_ENABLED=0") // Often needed for static builds
78- //
79- // output, err := cmd.CombinedOutput()
80- // if err != nil {
81- // return fmt.Errorf(
82- // "setup: go build main failed for module %s: %v\nOutput:\n%s",
83- // modulePath,
84- // err,
85- // string(output),
86- // )
87- // }
88- //
89- // // --- Debugging: Inspect the built file ---
90- // fileCmdPath, _ := exec.LookPath("file")
91- // if fileCmdPath != "" {
92- // fileCmd := exec.Command("file", outputBinaryPath)
93- // fileOutput, fileErr := fileCmd.CombinedOutput()
94- // if fileErr != nil {
95- // fmt.Printf("Setup: 'file %s' command failed: %v\n", outputBinaryPath, fileErr)
96- // } else {
97- // fmt.Printf("Setup: 'file %s' output: %s\n", outputBinaryPath, string(fileOutput))
98- // }
99- // } else {
100- // fmt.Printf("Setup: 'file' command not found, cannot inspect binary type.\n")
101- // }
102- // // --- End Debugging ---
103-
10427 return nil // Successful setup
10528 },
10629 })
0 commit comments