13 lines
218 B
Go
13 lines
218 B
Go
package main
|
|
|
|
import "errors"
|
|
|
|
func GetGun(gunType string) (IGun,error){
|
|
if gunType == "ak47" {
|
|
return newAk47(),nil
|
|
}
|
|
if gunType == "musket" {
|
|
return newMusket(),nil
|
|
}
|
|
return nil,errors.New("No such a gun")
|
|
} |