这可能吗?
switch type {
case let .dog(say): fallthrough
case let .cat(say):
print(say)
}
这不是有效的快速枚举,但有没有办法做到这一点? 基本上我的枚举都有相同的大小写动作,但参数值会有所不同。
答案 0 :(得分:2)
package main
/*
#cgo CFLAGS: -I.
#cgo LDFLAGS: -L. -lkeyboard
#include "keyboard.h"
*/
import "C"
import (
"fmt"
)
type student struct {
name string
ID int
}
func main() {
s := student{} //Need to know how to decide the length of the struct array
s = C.getAllStudents() //?????
}