-
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
Update go and golangci-lint #182
Conversation
54cabe1
to
1a7525e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one concern: the concurrency clean-up with the error channel could be made a lot simpler/more readable if you use "golang.org/x/sync/errgroup"
.
Otherwise, LGTM
cmd/demoserver/main_test.go
Outdated
@@ -70,13 +69,15 @@ func TestElizaServer(t *testing.T) { | |||
stream := client.Converse(context.Background()) | |||
var wg sync.WaitGroup | |||
wg.Add(2) | |||
errs := make(chan error, 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be much simpler to use an errgroup.Group
instead of sync.WaitGroup
and all of this error-tracking channel chicanery.
grp, ctx := errgroup.WithContext(context.Background())
// use ctx to start RPC ...
grp.Go(func() error {
// send messages, immediately return err on failure
// (instead of storing in channel)
})
grp.Go(func() error {
// receive messages, immediately return err on failure
})
require.NoError(t, grp.Wait())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big fan of the line error-tracking channel chicanery.
. Updated lmk what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better, thank you!
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
Signed-off-by: Steve Ayers <[email protected]>
821a93b
to
12a9dde
Compare
Now that a new version of Go has been released, this bumps the versions used in this repo.
This also updates golangci-lint to the latest, which called for some config changes to eliminate warnings.