-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/initial #2
Feat/initial #2
Conversation
pkg/celigo/client.go
Outdated
|
||
func New(accessToken string, region Region, httpClient *http.Client) *Client { | ||
baseUrl := BaseUrl | ||
if region == EURegion { |
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, style-ism: i'd tend to write this as a switch (region) { ... } with a default
that returns an erroor
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.
fixed in f77aee6
return req, nil | ||
} | ||
|
||
func (c *Client) do(req *http.Request, response ...interface{}) (*http.Response, error) { |
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.
should this be a vararg collector (....
-> []
) or just a single object?
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.
The reason why I use response ...interface{} is to have option use do without response body.
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.
Perhaps this is a much better solution: ConductorOne/baton-sdk#104 . Also, it makes sense to move to SDK since I use it in every other connector.
|
||
var resources []*v2.Resource | ||
for _, integration := range response { | ||
integration := integration |
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.
no-op assignment?
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.
same #2 (comment)
pkg/connector/users.go
Outdated
|
||
var resources []*v2.Resource | ||
for _, user := range response { | ||
user := user |
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: noop assignment
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 don't to prevent linter error:
pkg/connector/users.go:59:38: G601: Implicit memory aliasing in for loop. (gosec)
resource, err := userResource(ctx, &user)
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 FYI go v1.22 fixes this.
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.
Ok, gonna fix it.
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 tried that but it looks like that golangci-lint
use still the old rules https://stackoverflow.com/a/68247837 . I added error suppression comment.
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 a few small changes and then I think this is good to go.
Co-authored-by: Geoff Greer <[email protected]>
No description provided.