Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix goplus playground build #58

Merged
merged 1 commit into from
Apr 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions playground/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,28 +445,13 @@ func sandboxBuildGoplus(ctx context.Context, tmpDir string, in []byte, vet bool)
return nil, err
}

err = ioutil.WriteFile(filepath.Join(tmpDir, "go.mod"), []byte("module gop_autogen\n\ngo 1.16\n"), 0644)
if err != nil {
return nil, err
}

//use go get directly to
//1. avoid fixed version in go.mod
//2. and avoid some build warning
cmd := exec.Command("go", "get", "github.com/goplus/gop/builtin")
cmd.Dir = tmpDir
_, err = cmd.CombinedOutput()
if err != nil {
return nil, fmt.Errorf("error get github.com/goplus/gop/builtin: %v", err)
}

br := new(buildResult)

qgo, err := exec.LookPath("gop")
if err != nil {
return nil, fmt.Errorf("error find qgo command: %v", err)
}
cmdGenerate := exec.Command(qgo, "build", "-o", "a.out", "-tags=faketime", ".")
cmdGenerate := exec.Command(qgo, "build", "-o", "a.out", "prog.gop")
cmdGenerate.Dir = tmpDir

out := &bytes.Buffer{}
Expand Down