-
Notifications
You must be signed in to change notification settings - Fork 2
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
Pass ctx to constructor #14
Pass ctx to constructor #14
Conversation
Hi @ilya-hontarau! Thank you for your contribution! I think it is a good idea. Tests are failing because there was a breaking change in pgmq recently. I just updated so it should work now if you rebase. I left a few stylistic comments. Thanks again! |
cc439ba
to
2ab0c2b
Compare
pgmq_test.go
Outdated
"github.com/jackc/pgx/v5/pgconn" | ||
"github.com/stretchr/testify/require" | ||
"github.com/testcontainers/testcontainers-go" | ||
"github.com/testcontainers/testcontainers-go/wait" | ||
"go.uber.org/mock/gomock" | ||
|
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.
Nit: remove space
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.
will be great to use imports formatters
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.
Yeah, I had thought that the goimports
linter would have caught this, but it doesn't complain about newlines. Maybe gci
works better? Do you know any alternatives?
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.
It's weird that goimports is not complaining in ci either. Something seems to be not working there. Oh well.
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.
@craigpastro actually I like to split imports in 3 group:
- std
- external imports
- internal imports
I tried before GCI, but it still couldnt do this(maybe now they can?).
Also https://github.com/incu6us/goimports-reviser works fine, but it isn't a part of golangci lint:(
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.
I am pretty happy with
- std
- everything else
I am not sure how gci was working in the past but it seems that they can do what you like now by specifying something like:
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/craigpastro/pgmq-go)
By the way, I think the issue with ci is that the linter config contained:
issues:
fix: true
If I remove it then it fails when I expect it to. 🤷
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
==========================================
- Coverage 80.86% 80.25% -0.61%
==========================================
Files 1 1
Lines 162 157 -5
==========================================
- Hits 131 126 -5
- Misses 21 23 +2
+ Partials 10 8 -2
☔ View full report in Codecov by Sentry. |
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.
LGTM. Thanks!
New() makes a few remote calls, so I think it would be great to pass context to this function.
Also in my opinion retrying shouldn't be a part of a constructor(at least if don't specify any configs parameters).
So I made a breaking change(is it okay?), added context to New(), remove retrying, added ErrPing error on failed to ping.
Let me know what do you think.