pomack / thrift4go

Apache Thrift for the Go Language
129 stars 23 forks source link

Run ``gofmt -w`` on Emitted Go Output #41

Closed matttproud closed 12 years ago

matttproud commented 12 years ago

This pull requests builds on the others. I have further stylistic improvements I am going to make to the generated output that will be API-compatible for existing users, but I want to make this change first.

pomack commented 12 years ago

I'll take a look at all these pull requests on Thursday or Friday. I definitely want all these requests to be closed by the weekend.

matttproud commented 12 years ago

Hey Aalok,

I should be back in town tonight and able to review any comments you may have between now and then.

Take care,

Matt

pomack commented 12 years ago

I've committed this since there are only a couple issues I think still need to be addressed.

1) If an enum has a default value, the IsSet() test should check for the default value rather than math.MinInt32-1 2) ttype.go needs to be updated in CoerceData for lines (there are multiple) like the following to use b.Value() rather than data.(int):

if b, ok := data.(Enumer); ok {
    if i1, ok := data.(int); ok {
        return string(i1), true
    }
    return b.String(), true
}

3) If fields are not optional, should they even be returning False for IsSet()? Shouldn't they default to a valid value (0)?

I'll leave the changes to you Matt.