3 ms·
You’re not forced to use the "imperative verbosity" in the article. The following is shorter and more idiomatic. serializeType := model.SerializeNonArchive
by kjgkjhfkjf 7y ago
You’re not forced to use the "imperative verbosity" in the article. The following is shorter and more idiomatic.
serializeType := model.SerializeNonArchivedOnly
if showArchived {
serializeType = model.SerializeAll
}
- buzzerbetrayed 7y agoHow is this not imperative verbosity? Not to mention you are mutating an already assigned variable. You run in to problems when you want to know the type of serializeType and you look at the first assignment but don't see that there is a second one.
- masklinn 7y ago> You run in to problems when you want to know the type of serializeType and you look at the first assignment but don't see that there is a second one. Go is statically typed, so the type of serializeType doesn't change, only the value.