package mainfunc throwPanic(cars []string) { if len(cars) == 0 { panic("No cars for sale") } //具体实现……}func main() { throwPanic([]string{})}