Skip to content

Commit

Permalink
Fixed parsing error on Go 1.19
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
  • Loading branch information
ajnavarro committed Jul 20, 2023
1 parent 07ce2aa commit 5b8e146
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gnovm/pkg/repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package repl

import (
"bytes"
"errors"
"fmt"
"go/ast"
"go/format"
Expand Down Expand Up @@ -118,7 +119,7 @@ func (r *Repl) Process(input string) (out string, err error) {
return r.handleDeclarations(decl)
}

return "", fmt.Errorf("error parsing code as expression (error: %w) and as declarations (error: %w)", expErr, declErr)
return "", fmt.Errorf("error parsing code: %q", errors.Join(expErr, declErr))

Check failure on line 122 in gnovm/pkg/repl/repl.go

View workflow job for this annotation

GitHub Actions / gno2go (1.19.x)

undefined: errors.Join

Check failure on line 122 in gnovm/pkg/repl/repl.go

View workflow job for this annotation

GitHub Actions / test (1.19.x)

undefined: errors.Join

Check failure on line 122 in gnovm/pkg/repl/repl.go

View workflow job for this annotation

GitHub Actions / lint

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}

func (r *Repl) handleExpression(e *ast.File) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion gnovm/pkg/repl/repl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var fixtures = []struct {
},
{
Line: "var a := 1",
Error: "error parsing code as expression (error: error formatting code: 9:8: expected type, found ':=') and as declarations (error: error formatting code: 6:7: expected type, found ':=')",
Error: "error parsing code: \"error formatting code: 9:8: expected type, found ':='\\nerror formatting code: 6:7: expected type, found ':='\"",
},
},
},
Expand Down

0 comments on commit 5b8e146

Please sign in to comment.