🚨 Add some tooling/ linting

This commit is contained in:
Dan Jones 2025-09-07 22:01:33 -05:00
commit dc577bcb9c
5 changed files with 120 additions and 7 deletions

View file

@ -43,8 +43,6 @@ func ExampleGroup_justErrors() {
"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)
@ -71,7 +69,6 @@ func ExampleGroup_parallel() {
searches := []Search{Web, Image, Video}
results := make([]Result, len(searches))
for i, search := range searches {
i, search := i, search // https://golang.org/doc/faq#closures_and_goroutines
g.Go(func() error {
result, err := search(ctx, query)
if err == nil {
@ -120,7 +117,6 @@ func TestZeroGroup(t *testing.T) {
var firstErr error
for i, err := range tc.errs {
err := err
g.Go(func() error { return err })
if firstErr == nil && err != nil {
@ -153,7 +149,6 @@ func TestWithContext(t *testing.T) {
g, ctx := errgroup.WithContext(context.Background())
for _, err := range tc.errs {
err := err
g.Go(func() error { return err })
}
@ -267,7 +262,6 @@ func TestCancelCause(t *testing.T) {
g, ctx := errgroup.WithContext(context.Background())
for _, err := range tc.errs {
err := err
g.TryGo(func() error { return err })
}