-
Notifications
You must be signed in to change notification settings - Fork 44
Conversation
I have a hunch we should really make fs-repo-migrations easier to write, with generators or templates, or something like that. Given that one of the most prominent devs is trying to avoid migrations :) |
My primary issue with migrations is having to download them. That adds an extra update step that can easily fail. Also, this change will probably break a ton of our test tooling (as it will break |
8b4cdc9
to
8f3f64a
Compare
Alternative to #6 that doesn't require a migration.
8f3f64a
to
0386478
Compare
So, @whyrusleeping at least doesn't think this is that bad and, unlike #6, this doesn't break any existing tooling (i.e., anything that runs |
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.
1 Question to implementation, idea sgtm
func (o Strings) MarshalJSON() ([]byte, error) { | ||
switch len(o) { | ||
case 0: | ||
return json.Marshal(nil) |
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.
Shouldn't this be returning an empty array? Or will the marshaller just omit the entry if it's nil?
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.
json.Marshal(nil)
will get the value []byte("null")
, so i think it makes sense.
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.
Exactly. Basically, I'd like to use null
for the case where no API addresses are specified.
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.
@overbool want to file a PR against go-ipfs that uses 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.
@Stebalien Did you mean this ipfs/kubo#5401?
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 :)
String-to-array is actually a nice coercion in some cases
Alternative to #6 that doesn't require a migration. This is probably a terrible idea.