package cgroup import "fmt" //go:generate stringer -type=Controller -linecomment const ( ControllerUndefined Controller = iota // undefined ControllerPids // pids ControllerCPU // cpu ControllerMemory // memory ControllerRdma // rdma ControllerIo // io ) type Controller int func ParseController(in string) (Controller, error) { switch in { case ControllerPids.String(): return ControllerPids, nil case ControllerCPU.String(): return ControllerCPU, nil case ControllerMemory.String(): return ControllerMemory, nil case ControllerRdma.String(): return ControllerRdma, nil case ControllerIo.String(): return ControllerIo, nil default: return ControllerUndefined, fmt.Errorf("Controller(%s)", in) } }