Use Go Tools Dlv

Debugging Go project prepare: + vscode + golang 1.92 demo go mod init test In main.go file package main import ( "fmt" ) // Swap functions func swap(x, y *string) (string, string) { //XOR exchange *x, *y = *y, *x } func main() { fmt.Println("Hello, world!") //Swap functions for i := 0; i < 10; i++ { a := "a" b := "b" swap(&a, &b) fmt.Println(a, b) } } vscode generates tests with one click >gotest for package/function ::: tip They are to generate test units for packages and test units for functions....

February 24, 2023 · 17 min · 3420 words · Xinwei Xiong, Me