Gofmt was written specifically to reduce meaningless discussions about code formatting, which was great. Unfortunately, this did not affect the number of meaningless discussions about syntax highlighting or, as I prefer to call it, spitzensparken blinkelichtzen.
Syntax highlighting - for small ones. In childhood I was taught arithmetic on colored sticks . Now I have grown up and use black and white numbers.
This has been discussed several times in the past, including before the open release. Then we came to the conclusion that sum types do not particularly extend the interface types. If you look, in the end it all comes down to the fact that the compiler checks that you have filled in all cases of type switching. This is a pretty minor advantage to change the language.
, enum :keywords . (, , «`enumeration value x'
, switch»).
go get
. — , Go .
vendor
, , «» «» .
error
, nil
« ».
error
- , , — .
a, err := fallibleOperationA()
if err != nil {
return nil, err
}
b, err := fallibleOperationB(a)
if err != nil {
return nil, err
}
return b, nil
a = fallibleOperationA()
b = fallibleOperationB(a)
return b
return fallibleOperationA()
.then(a => fallibleOperationB(a))
.result()
a, err := fallibleOperationA()
if err != nil {
return nil, err
}
if err := fallibleOperationB(a); err != nil {
return nil, err
}
c, err := fallibleOperationC(a)
if err != nil {
return nil, err
}
fallibleOperationD(a, c)
return fallibleOperationE()
Source: https://habr.com/ru/post/434446/