package utils import ( "log" "os" "runtime" "strconv" "strings" ) func Cwd(i int) string { _, fp, _, _ := runtime.Caller(i) slice := strings.Split(fp, "/") slice = slice[:len(slice)-1] path := strings.Join(slice, "/") return path } func CheckArgs() { if len(os.Args) < 2 { log.Fatalf("ERROR: port number required: eg ./bin 3000") } _, err := strconv.Atoi(os.Args[1]) if err != nil { log.Fatalf("ERROR: port must be a number") } }