Golang语言中 switch case 条件判断用法说明
func NewPrinter(printerType string) printer {
switch printerType {
case "simple":
return &simplePrinter{}
case "fields":
return &fieldsPrinter{newPrinterUnsupported("fields")}
case "json":
return newJSONPrinter()
case "protobuf":
return newPBPrinter()
case "table":
return &tablePrinter{newPrinterUnsupported("table")}
}
return nil
}