consider the small snippet below:
package main
import (
"fmt"
"sync"
)
func main() {
var wg sync.WaitGroup
wg.Add(2)
go func() {
defer wg.Done()
for i := 1; i < 100; i++ {
fmt.Println("A:", i)
}
}()
go func() {
defer wg.Done()
for i := 1; i < 100; i++ {
fmt.Println("B:", i)
}
}()
wg.Wait()
}
in delve, we can easily switch between goroutines using the commands like
goroutine
goroutine <id>
goroutine <id> <command>
and if i want run step by step in goroutine 1, just use the command
goroutine 1 next
In vscode, it seems the only way to deal with goroutines is the call stack, however, it seems that this is the internal threads in go runtime, not the goroutines, so how can i focus the running process in the specified goroutine?