package config type RuntimeConfig struct { Name string Extension string MIMEType string } var Runtimes = []RuntimeConfig{ {Name: "bash", Extension: ".sh", MIMEType: "text/x-shellscript"}, {Name: "zsh", Extension: ".zsh", MIMEType: "text/x-shellscript"}, {Name: "sh", Extension: ".sh", MIMEType: "text/x-shellscript"}, {Name: "fish", Extension: ".fish", MIMEType: "text/x-shellscript"}, {Name: "python3", Extension: ".py", MIMEType: "text/x-python"}, {Name: "node", Extension: ".js", MIMEType: "text/javascript"}, {Name: "ruby", Extension: ".rb", MIMEType: "text/x-ruby"}, {Name: "php", Extension: ".php", MIMEType: "text/x-php"}, } var RuntimeMap map[string]RuntimeConfig func init() { RuntimeMap = make(map[string]RuntimeConfig, len(Runtimes)) for _, rt := range Runtimes { RuntimeMap[rt.Name] = rt } } func IsValidRuntime(name string) bool { _, ok := RuntimeMap[name] return ok } func GetRuntime(name string) (RuntimeConfig, bool) { rt, ok := RuntimeMap[name] return rt, ok }