We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Example: https://pkg.go.dev/golang.org/x/sync/errgroup#Group.Wait
Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0
Modify the example code, in this case, it was a bad code and panicked.
package main import ( "fmt" "net/http" "golang.org/x/sync/errgroup" ) func main() { g := new(errgroup.Group) var urls = []string{ "http://www.golang.org/", "http://www.google.com/", "http://www.somestupidname.com/", } for _, url := range urls { // Launch a goroutine to fetch the URL. url := url // https://golang.org/doc/faq#closures_and_goroutines g.Go(func() error { // Fetch the URL. resp, err := http.Get(url) if err != nil { fmt.Println("error encountered") resp.Body.Close() return nil } fmt.Println("ignoring error if any") resp.Body.Close() return nil }) } // Wait for all HTTP fetches to complete. if err := g.Wait(); err == nil { fmt.Println("Successfully fetched all URLs.") } }
Error message
Output: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x61cb7a] goroutine 7 [running]: main.main.func1() /tmp/sandbox1760300329/prog.go:25 +0x7a golang.org/x/sync/errgroup.(*Group).Go.func1() /tmp/gopath4274196458/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 +0x64 created by golang.org/x/sync/errgroup.(*Group).Go /tmp/gopath4274196458/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:72 +0xa5
It tells the line on which error occurred. But the code is not numbered, and hence it is difficult to determine the code line that threw error.
It would be helpful if the code blocks were numbered.
The text was updated successfully, but these errors were encountered:
dle8
No branches or pull requests
What is the URL of the page with the issue?
Example: https://pkg.go.dev/golang.org/x/sync/errgroup#Group.Wait
What is your user agent?
Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0
Screenshot
What did you do?
Modify the example code, in this case, it was a bad code and panicked.
What did you expect to see?
Error message
It tells the line on which error occurred. But the code is not numbered, and hence it is difficult to determine the code line that threw error.
It would be helpful if the code blocks were numbered.
What did you see instead?
The text was updated successfully, but these errors were encountered: