diff --git a/rc/rc.go b/rc/rc.go index 733226b1..b994a50c 100644 --- a/rc/rc.go +++ b/rc/rc.go @@ -99,7 +99,7 @@ func main() { filename := goFile(flag.Args()) if filename == "" { - fmt.Println("No file to analyse") + fmt.Println("\tNo file to analyse") os.Exit(1) } @@ -108,7 +108,7 @@ func main() { err := parseArgs(flag.Args(), allowBuiltin, casting) if err != nil { - fmt.Println(err) + fmt.Printf("\t%s\n", err) os.Exit(1) } @@ -119,7 +119,7 @@ func main() { err = loadProgram(currentPath, load) if err != nil { - fmt.Println(err) + fmt.Printf("\t%s\n", err) os.Exit(1) } fmt.Println("\tOk") @@ -609,11 +609,15 @@ func parseArgs(toAllow []string, builtins bool, casting bool) error { funcName = filepath.Base(v) spl := strings.Split(funcName, ".") path = path + "/" + spl[0] - funcName = spl[1] + if len(spl) > 1 { + funcName = spl[1] + } } else if strings.ContainsRune(v, '.') { spl := strings.Split(v, ".") path = spl[0] - funcName = spl[1] + if len(spl) > 1 { + funcName = spl[1] + } } else { path = "builtin" funcName = v diff --git a/rc/rc_test.go b/rc/rc_test.go index 8f9cbce2..26babefc 100644 --- a/rc/rc_test.go +++ b/rc/rc_test.go @@ -122,10 +122,10 @@ Cheating: Cheating: Ok `, - `tests/empty/empty len`: `No file to analyse + `tests/empty/empty len`: ` No file to analyse `, `tests/empty/empty.go`: `Parsing: -tests/empty/empty.go:1:1: expected ';', found 'EOF' (and 2 more errors) + tests/empty/empty.go:1:1: expected ';', found 'EOF' (and 2 more errors) `, } Compare(t, argsAndSolution)