Recent Posts

Go - Maps

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,...

Go - Slices

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 (...

Go - Slices - 3

Ex. Slice is in the middle of an array, what will happen in that array after append? => Array value will reflect slice change, but array instance will ...

Go - Slices - 2

Slice is NOT comparable Standard library provide a way to compare 2 byte slices Reference type such as pointers and channels, the == test whether...

Go - Slices -1

Slice is declared as "var s []T" Declare a slice by make([]int,length,capacity) Slice looks like an array without size Pointer: point to the first eleme...

Go - Arrays

Declare an array Ex. var a [3]int a[0] len(a) for idx, v range a {} for _, v range a ,{} Declare with specified values. Default value is ...

Go - Boolean and Strings

Boolean bool boolean Strings Conventionally UTF-8 Built-in function len returns the number of bytes, not runes in a string Detect length of s...

Go - float

float  float32, max value: math.MaxFloat32 float64, max value: math.MaxFloat64 float can be printed by fmt package %e: exponent %f: no ex...

Go - Integers

int8 int16 int32 int64 uint8 uint16 uint32 uint64 int uint : natural and most efficient size on a particular platform. Different compiler may choose di...

Go - Scope

Syntactic block: Enclosed in braces Lexical block: Not explicitly surrounded by braces Universe block: A lexical block for the entire source code. In...

Go - Package import and initialization

Package Import Import path: packages are identified by an unique string, called import path Go lang spec doesn't define what "import path" mean, it's u...

Go - Package and Files

Package Variables Exported identifiers start with an upper-case letter files in the same package can be in the same folder Package level variables ca...

Go - Type Declarations

Named type Format: type typeName underlying-type A constructor with underlying-type value will exist without declaring package main import (  &n...

Go - Assignments

Tuple Assignment Type Assertion Need use interface{} to declare a variable Check concrete type by v,ok := x.(T)  If type "T" can't be assigned ...

Go - Declare Pointers

A pointer value is the address of a variable Declare a variable, declare a value, assign address to that variable Variable address declared in functi...

Go - Declare Variables

Declaration Declare package Declare import var/const/func/type can be declared in any order Variables Declare variables with the same type a...

Go - helloworld in eclipse

Introduction When trying the first helloworld, I encountered some problem to setup environment. So note here. You can find manual for complete informati...