-
Notifications
You must be signed in to change notification settings - Fork 50
docs: add hints for go fix tool
#849
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,19 +10,31 @@ func Ptr[T any](p T) *T { | |
| // String returns a pointer to the passed string s. | ||
| // | ||
| // Deprecated: Use [Ptr] instead. | ||
| // | ||
| //go:fix inline | ||
| func String(s string) *string { return Ptr(s) } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, we will soon be able to suggest new(d), is this really worth changing now? |
||
|
|
||
| // Int returns a pointer to the passed integer i. | ||
| // | ||
| // Deprecated: Use [Ptr] instead. | ||
| // | ||
| //go:fix inline | ||
| func Int(i int) *int { return Ptr(i) } | ||
|
|
||
| // Bool returns a pointer to the passed bool b. | ||
| // | ||
| // Deprecated: Use [Ptr] instead. | ||
| // | ||
| //go:fix inline | ||
| func Bool(b bool) *bool { return Ptr(b) } | ||
|
|
||
| // Duration returns a pointer to the passed time.Duration d. | ||
| // | ||
| // Deprecated: Use [Ptr] instead. | ||
| // | ||
| //go:fix inline | ||
| func Duration(d time.Duration) *time.Duration { return Ptr(d) } | ||
|
|
||
| func IgnoreError[T any](t T, _ error) T { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This helper is necessary to make it possible to inline (*FloatingIP).DNSPtrForIP. If we don't want to export it we could consider moving it to exp/ (though there would be an import cycle if we moved it to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I am not sure this is a good idea. We should probably not officially suggest ignoring errors. I'd rather leave this function out and require manual intervention from the users. |
||
| return t | ||
| } | ||
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 added
ID: []int64{}explicitly here to make clear that a list of IDs is expected. This function should have been broken for over a year anyway.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.
Hmm, there is no real replacement for this function, the feature has been removed, so I think we should only have it deprecated. Fixing this requires manual intervention.
Otherwise we replace the deprecated function with a function that is not deprecated but also not working, and we remove the information from the users that the feature is removed.