1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package goctl import ( "os" "strconv" ) var pid string type cmdPID struct{} func (cmd cmdPID) Name() string { return "pid" } func (cmd cmdPID) Run(_ *Goctl, _ []string) string { return pid } func init() { pid = strconv.Itoa(os.Getpid()) builtinHandlers = append(builtinHandlers, cmdPID{}) }