Go - Method Values
Can assign method to a variable Ex. M = s.methodname; M() Can define func signature and assign implementation later Status will follow methods ...
Can assign method to a variable Ex. M = s.methodname; M() Can define func signature and assign implementation later Status will follow methods ...
<div> Under Cassandra-2.0.17, I want to query a table by cqlsh</div> First of all, I put query in a file: ~/query.cql select * from "myData"...
Declare Method Method and Function can be the same name Method and Field can not have the same name Can declare another method name in the sa...
During panic, normal execution stop, defered function in goroutine executed and the program crash with log message Ex. Declare a panic. A pan...
Declare variadic function Variadic function parameter type is .... Different from slice. Action can be defered with a defer statement. Defered fun...
Must declare a func before let func call itself recursively. Otherwise compile error Loop will reuse variable address, so a new variable must be dec...
Can declare function without name. Called anonymous function. How client know it needs return value? => Because function signature has conc...
Modifications to the parameter copy don't affect the caller except pointer, slice, map, function, channel A function declaration without a body indica...
Declare func name(parameter-list) return-list {...} Parameter list type can be declared only once if types are the same func test(a string, b string,...
ex. var p = Person{}; json.Marshal(p) json.marshal return byte slice contains long string wuthout extraneous Ex.data, err = json.MarshalIndent...
Name and visibility is implicitly determined by its type Outer struct type gains not just the fields of the embedded type but its methods too
Comparable struct can be a key of a map. (What will happen when struct value changed?) Can declare a named struct type in another struct as field ...
Shorthand notation to create and initialize a struct variable Ex. pp := &Point{1,2} It’s same as pp := new(Point) *pp = Point{1,2} If all f...
A struct can be declared to require client need assign values to each fields with right order. Such pattern will be hard to maintain in the future...
A named type S CAN NOT declare a field with the same type S, but it can contains a field with type *S, for recursive data structure Zero struct field...
Declared: map[KeyType]ValueType Ex. m := make(map[string]int) m["a"]=1 m{"b"]=2 Ex. m := map[string]int { "a":1, "b":2,...
Slices contains many example images, causes I can’t save in Blogger in one article. So I split to 3 parts. Go - Slices (1/3) Go - Slices (2/3) Go - Slices (...