go
IAmLinGe
这个作者很懒,什么都没留下…
展开
-
go返回多个值和python返回多个值对比
go函数返回多个值与python函数返回多个值对比原创 2020-06-23 17:15:41 · 282 阅读 · 0 评论 -
go 语言 first argument to append must be slice
错误代码func TestSliceGrowing(t *testing.T) { s := [4]int{1, 2, 3, 4} for i :=0; i<10; i++ { s = append(s, i) t.Log(len(s), cap(s)) }}报错代码s = append(s, i)原因:append的第一个参数必须是切片更正func TestSliceGrowing(t *testing.T) { s := []int{1, 2, 3, 4} fo原创 2020-06-15 20:16:46 · 2642 阅读 · 0 评论 -
go语言 expected ; found a
错误代码,这是一段测试go语言类型转换的代码package type_testimport "testing"type MyInt int64func TestImplicit(t *testing.T) { var a int32 = 1 var b int64 = 3 b = (int64)a var c MyInt = 4 // c = b t.Log(a, b, c)}报错代码b = (int64)a改正b = int64(a)go语言版本:1.14.4原创 2020-06-15 20:09:32 · 2099 阅读 · 0 评论