Skip to content
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

Merged
merged 3 commits into from
Sep 4, 2024
Merged

Update go and golangci-lint #182

merged 3 commits into from
Sep 4, 2024

Conversation

smaye81
Copy link
Member

@smaye81 smaye81 commented Sep 3, 2024

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.

Copy link
Member

@jhump jhump left a 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

@@ -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)
Copy link
Member

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())

Copy link
Member Author

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.

cmd/demoserver/main_test.go Outdated Show resolved Hide resolved
Copy link
Member

@jhump jhump left a 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!

@smaye81 smaye81 merged commit 5f010ea into main Sep 4, 2024
8 checks passed
@smaye81 smaye81 deleted the sayers/update_go_1.22 branch September 4, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants