-
Notifications
You must be signed in to change notification settings - Fork 47
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
add a couple useful methods #102
Conversation
cid.go
Outdated
|
||
// WriteTo writes the cids bytes to the given writer | ||
func (c Cid) WriteTo(w io.Writer) error { | ||
_, err := io.WriteString(w, c.str) |
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.
worth checking if this has fully written the string?
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.
actually, probably better just to satisfy the WriterTo interface and return the write size
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.
this won't work with the IO methods unless it has a loop as i'm reading the interface contract.
It should either go until there's an error, or until it's written the full string - right?
ref: https://golang.org/pkg/io/#WriterTo
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.
mmm, i think youre right there.... Maybe i'll pick a different function name. I don't particularly care for loops here
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.
Personally I just abuse KeyString, but this is a nicer way to go.
No description provided.