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

Debug bypass go flags #278

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions cmd/xgo/test-explorer/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ func debug(ctx *RunContext) error {
args := ctx.Args
env := ctx.Env

err := debugTest(goCmd, projectDir, file, buildFlags, []string{"./" + filepath.Dir(relPath)}, fmt.Sprintf("^%s$", name), stdout, stderr, args, env)
err := debugTest(goCmd, projectDir, file, buildFlags, []string{"./" + filepath.Dir(relPath)}, false, fmt.Sprintf("^%s$", name), stdout, stderr, args, env)
if err != nil {
return err
}
return nil
}

func debugTest(goCmd string, dir string, file string, buildFlags []string, buildArgs []string, runNames string, stdout io.Writer, stderr io.Writer, args []string, env []string) error {
func debugTest(goCmd string, dir string, file string, buildFlags []string, buildArgs []string, bypassGoFlags bool, runNames string, stdout io.Writer, stderr io.Writer, args []string, env []string) error {
if goCmd == "" {
goCmd = "go"
}
Expand Down Expand Up @@ -91,7 +91,12 @@ func debugTest(goCmd string, dir string, file string, buildFlags []string, build
fmt.Fprintln(stderr, debug_util.FormatDlvPrompt(port))
}, func(port int) error {
// dlv exec --api-version=2 --listen=localhost:2345 --accept-multiclient --headless ./debug.bin
runArgs := append([]string{"-test.v", "-test.run", runNames}, args...)
runArgs := make([]string, 0, 3+len(args))
runArgs = append(runArgs, "-test.v", "-test.run", runNames)
if bypassGoFlags {
runArgs = append(runArgs, "--")
}
runArgs = append(runArgs, args...)
return cmd.Dir(filepath.Dir(file)).Debug().Stderr(stderr).Stdout(stdout).
Env(env).
Run("dlv", debug_util.FormatDlvArgs(tmpBin, port, runArgs)...)
Expand Down
2 changes: 1 addition & 1 deletion cmd/xgo/test-explorer/run_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (c *runSession) Start() error {
testArgs := joinTestArgs(pathArgs, runNames)
err = runTest(c.goCmd, c.dir, testFlags, testArgs, c.bypassGoFlags, c.progArgs, c.env, stdout, stderr)
} else {
err = debugTest(c.goCmd, c.dir, item.File, testFlags, pathArgs, runNames, stdout, stderr, c.progArgs, c.env)
err = debugTest(c.goCmd, c.dir, item.File, testFlags, pathArgs, c.bypassGoFlags, runNames, stdout, stderr, c.progArgs, c.env)
}

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/xgo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import "fmt"

// REVISION and NUMBER are auto updated when run 'git commit'
// VERSION is manully updated when needed a new tag

Check warning on line 6 in cmd/xgo/version.go

View workflow job for this annotation

GitHub Actions / check-build

"manully" should be "manually".

Check warning on line 6 in cmd/xgo/version.go

View workflow job for this annotation

GitHub Actions / check-build

"manully" should be "manually".
// see also runtime/core/version.go
const VERSION = "1.0.49"
const REVISION = "bfe5f14d7bfaf52b5dfecb95aaaa717e0ff4d3c9+1"
const NUMBER = 310
const REVISION = "1d8b33c2ca5fafec9439a1ec7adcdc591db705b9+1"
const NUMBER = 311

// the matching runtime/core's version
// manually updated
Expand Down
Loading