萌新求问,下面这段代码为啥会panic
type Action interface {
String()string
}
type TestAction struct {
s string
}
func (r *TestAction)String()string {
return r.s
}
func returnAction()*TestAction {
return nil
}
func getAction() Action {
return returnAction()
}
func TestI(t *testing.T){
a:= getAction()
if a!=nil{
a.String()
}
}

type Action interface {
String()string
}
type TestAction struct {
s string
}
func (r *TestAction)String()string {
return r.s
}
func returnAction()*TestAction {
return nil
}
func getAction() Action {
return returnAction()
}
func TestI(t *testing.T){
a:= getAction()
if a!=nil{
a.String()
}
}