-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Built-in Function: bin #2924
Built-in Function: bin #2924
Conversation
expression/builtin_string.go
Outdated
} | ||
bits := fmt.Sprintf("%b", uint64(num)) | ||
d.SetString(bits) | ||
|
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.
Remove the empty line.
if err != nil { | ||
return d, errors.Trace(err) | ||
} | ||
arg := args[0] |
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.
Check if arg.IsNil()
{10, "1010"}, | ||
{10.0, "1010"}, | ||
{-1, "1111111111111111111111111111111111111111111111111111111111111111"}, | ||
{"-1", "1111111111111111111111111111111111111111111111111111111111111111"}, |
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.
Add a test case for nil input.
@silentred Thanks for your PR! Please resolve the conflicts and address the comments. |
LGTM |
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
@silentred |
Also fixed three places where golint throws warning.