-
Notifications
You must be signed in to change notification settings - Fork 19
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
trace: Record snapshot trace of main modules when using xgo e #281
Comments
We would like to make We currently have 5 options related to trap, mock and trace:
To make these default behavior happen, we'd like to add two flags:
But I'd more likely to only implement the snapshot tracing of main module first. Reducing trace of non-main module does not gain extra benefit currently. |
Setup: mkdir tmp
cd tmp
go mod init github.com/xhd2015/xgo/tmp
go get github.com/xhd2015/xgo/runtime/trace
# in.mod:
# replace github.com/xhd2015/xgo/runtime => ../runtime
package snapshot
type User struct {
Count int
}
func updateUser(user *User) *User {
user.Count++
return user
}
package snapshot
import (
"testing"
_ "github.com/xhd2015/xgo/runtime/trace"
)
// go run ./cmd/xgo test --project-dir ./tmp --strace ./snapshot_main
func TestSnapshot(t *testing.T) {
user := &User{}
updateUser(user)
updateUser(user)
updateUser(user)
} Test: # in xgo's root
go run ./cmd/xgo test --project-dir ./tmp --log-debug --strace -v --reset-instrument ./
go run ./cmd/xgo tool trace tmp/TestSnapshot.json |
Need to add an extra flag to enable this mode
The text was updated successfully, but these errors were encountered: