From 1bff92c52b27b9a516599e172fe9852c3d99be38 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 2 Apr 2024 11:27:13 +0200 Subject: chore: add linters and some lint fixes (#8) * chore: add linters and some lint fixes Configure some golangci-lint linters to get the code quality right. Apply the first fixes. Next step will be to add github actions to run lint and tests in github CI. * chore: more lint, fixed comments and variable names. no semantic change. * chore: add Makefile This makefile is intended to be used as a local substitute to github actions. --- main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index f566510..f9f125b 100644 --- a/main.go +++ b/main.go @@ -44,14 +44,15 @@ func repl(interp Interpreter, in io.Reader) (err error) { for liner.Scan() { text += liner.Text() res, err := interp.Eval(text + "\n") - if err == nil { + switch { + case err == nil: if !res.IsNil() { fmt.Println(": ", res) } text, prompt = "", "> " - } else if errors.Is(err, scanner.ErrBlock) { + case errors.Is(err, scanner.ErrBlock): prompt = ">> " - } else { + default: fmt.Println("Error:", err) text, prompt = "", "> " } @@ -64,8 +65,8 @@ func run(arg []string) (err error) { rflag := flag.NewFlagSet("run", flag.ContinueOnError) rflag.Usage = func() { fmt.Println("Usage: parscan run [options] [path] [args]") - //fmt.Println("Options:") - //rflag.PrintDefaults() + // fmt.Println("Options:") + // rflag.PrintDefaults() } if err = rflag.Parse(arg); err != nil { return err -- cgit v1.2.3