go
清醒思考
有问题可以私信我.
展开
-
go : 条件和循环
go : 条件和循环package condition_testimport "testing"func TestSwitchMultiCase(t *testing.T) { for i := 0; i < 5; i++ { switch i { case 0, 2: t.Log("Even") case 1, 3: t.Log("Odd") default: t.Log("it is not 0-3") } }}func TestSwitch原创 2021-06-02 21:56:55 · 74 阅读 · 0 评论 -
go : 运算符
go : 运算符package operator_testimport "testing"const ( Readable = 1 << iota Writable Executable)func TestCompareArray(t *testing.T) { a := [...]int{1, 2, 3, 4} b := [...]int{1, 3, 4, 5} d := [...]int{1, 2, 3, 4} t.Log(a == b) t.Log(a ==原创 2021-06-02 21:36:08 · 80 阅读 · 0 评论 -
go : 数据类型
go : 数据类型package type_testimport "testing"type MyInt int64func TestImplicit(t *testing.T) { var a int32 = 1 var b int64 b = int64(a) var c MyInt c = MyInt(b) t.Log(a, b, c)}func TestPoint(t *testing.T) { a := 1 aPtr := &a t.Log(a, aPt原创 2021-06-02 21:20:46 · 69 阅读 · 0 评论 -
go : 变量, 常量的定义
go : 变量, 常量的定义package fibimport ( "testing" "fmt")func TestFibList(t *testing.T) { a := 1 b := 1 t.Log(a) for i:=0;i<5;i++ { t.Log(" ", b) tmp := a a = b b = tmp + a } fmt.Println()}func TestExchange(t *testing.T) { a := 1 b :=原创 2021-05-31 15:32:07 · 88 阅读 · 0 评论 -
go : 单元测试打印测试结果
go : 单元测试打印测试结果go test -v $file原创 2021-05-31 15:06:14 · 352 阅读 · 0 评论 -
go : 1.hello world
go : 1.hello worldpackage mainimport "fmt"func main() { fmt.Println("Hello World")}原创 2021-05-29 14:31:59 · 70 阅读 · 0 评论