Go - Interface value
Real type of an interface variable is decided dynamatically Need be careful when comparing interface, panic will occur when real type is not comparable ...
Real type of an interface variable is decided dynamatically Need be careful when comparing interface, panic will occur when real type is not comparable ...
When a type value assign to a variable, it can call method declared with type value and pointer When a type pointer assign to a variable, it can call...
A function declared with type (not a pointer), can call method by type value. Can use (&t) to call method by address as well When a function d...
Declare embedding interface No problem if two interfaces have same method
Don't need implement interface, only method is enough Compile error if signature is wrong, Although don't need declare "implements", but sti...
Access control: upper case ecported to diiferent package It means the unit of encapsulation is package Difference Ex. type A int, can’t be encapsul...
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