This is a creation in Article, where the information may have evolved or changed.
Here, I want to record, learn, use the Go language, for the go language uncomfortable places.
1. function return type after the parameter type, it is not easy to see clearly the return type of the function
As below, is not a kind of very flower feeling.
Func Newreader (S string) *reader func (R *reader) Len () int func (r *reader) Read (b []byte) (n int, err error)
func (R *reader) ReadAt (b []byte, off Int64) (n int, err error) func (R *reader) ReadByte () (b byte, err error) F UNC (R *reader) readrune (Ch rune, size int, err error) func (R *reader) Seek (offset int64, whence int) (Int64, Erro R) func (R *reader) Size () Int64 func (R *reader) unreadbyte () Error func (r *reader) Unreadrune () error
func (R *reader) writeto (w io). Writer) (n Int64, err error)
2. The return type of the function declaration, and the returned value syntax are inconsistent
If the return type is multiple, you must use parentheses (), and you cannot use parentheses when returning in the body of the function
Func SAWP (a int, b int) (r1 int, R2 int) { return R2, R1//cannot use return (R2, R1)}
3. Allow there is no semicolon behind the statement, resulting in a switch to C + + when it is customary without semicolons, compile errors
Of course, when writing python, there is no semicolon. But Python is completely formatted, not easily confused with C + +. Go switch is so used to.
# # # # Keep waiting for updates # #