The word marshaling means converting from a Go data type to an encoding, and unmarshaling means converting to a Go data type.Marshalling可译作集结、结集、编码、编组
DurationA period of time is represented with a time.Duration, a type based on an int64.The smallest amount of time that Go can represent is one nanose
readertype Reader interface {Read(p []byte) (n int, err error)}type Writer interface {Write(p []byte) (n int, err error)}The Read method on io.Reader
多核 & 多线程多核CPU( CentralProcessingUnit): 中央处理单元,CPU不等于物理核,更不等于逻辑核。物理核(physical core/processor): 可以看的到的,真实的cpu核,有独立的电路元件以及L1,L2缓存,可以独立地执行指令。逻辑核( logi
package & directory & importimport path & package clause & export这里,首先,要澄清一个概念,就是directory 与 package,我们看到package,总翻译成包,但是在go中,package其
error is a type—the error typethe error is a type ,like int 、string、boolfunc calcRemainderAndMod(numerator, denominator int) (int, int, error) { if
Zero Value For Typeint: 0string: “”bool: falseSlice: nilMap: nilstruct: zero value 不是nilnil is a predeclared identifier representing the zero value f
Typestype Person struct {FirstName stringLastName stringAge int}this should be read as declaring a user-defined type with the namePerson to hav
the basics of using pointerthe variable of pointer type & pointer type我们需要区分2个概念:the variable of pointer typepointer typevar pointerToX *int上面的代码