fix #1252 check LLGO_ROOT with pkg github.com/goplus/llgo/runtime

This commit is contained in:
Li Jie
2025-09-01 20:18:31 +08:00
parent 2160710884
commit 0cac1c8a9d
2 changed files with 14 additions and 8 deletions

4
internal/env/env.go vendored
View File

@@ -97,12 +97,12 @@ func isLLGoRoot(root string) (string, bool) {
return "", false
}
// Check for go.mod
data, err := os.ReadFile(filepath.Join(root, "go.mod"))
data, err := os.ReadFile(filepath.Join(root, LLGoRuntimePkgName, "go.mod"))
if err != nil {
return "", false
}
// Check module name
if !strings.Contains(string(data), "module "+LLGoCompilerPkg+"\n") {
if !strings.Contains(string(data), "module "+LLGoRuntimePkg+"\n") {
return "", false
}
return root, true