From 1986d8e0db2b8601138f668788cb9c9ca343ae6d Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Tue, 28 Aug 2018 16:12:04 +0300 Subject: [PATCH 1/2] Fix ineffectual assignment to err. --- eval/eval.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eval/eval.go b/eval/eval.go index d00e64f..63a2f20 100644 --- a/eval/eval.go +++ b/eval/eval.go @@ -692,6 +692,9 @@ func (p *Program) evalStmt(s stmt.Stmt) []reflect.Value { pkg = gowrap.Pkgs[path] if pkg == nil { adjPkgPath, dir, err := gotool.M.Dir(path) + if err != nil { + panic(Panic{val: err}) + } pkgb, err := gengo.GenGo(filename, filepath.Base(path)) if err != nil { panic(Panic{val: err}) From 2afc44fe92702491adbbba3f8ca45a335e18e15a Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Tue, 28 Aug 2018 16:15:26 +0300 Subject: [PATCH 2/2] Fix typos found by misspell. --- eval/method.go | 2 +- eval/testdata/method5.ng | 4 ++-- format/format_test.go | 4 ++-- ng.go | 2 +- ngcore/ngcore.go | 2 +- parser/parser.go | 2 +- typecheck/typecheck.go | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eval/method.go b/eval/method.go index 22753a1..bceb739 100644 --- a/eval/method.go +++ b/eval/method.go @@ -110,7 +110,7 @@ func (p *Program) reflectNamedType(t *tipe.Named, methods []*expr.FuncLiteral) ( return rt, nil } -// evalMethRecv puts the method reciever in the current scope. +// evalMethRecv puts the method receiver in the current scope. func (p *Program) evalMethRecv(e *expr.FuncLiteral, recvt *tipe.Named, v reflect.Value) { var arg reflect.Value diff --git a/eval/testdata/method5.ng b/eval/testdata/method5.ng index bca5202..2e879b8 100644 --- a/eval/testdata/method5.ng +++ b/eval/testdata/method5.ng @@ -8,7 +8,7 @@ methodik obj struct{ o := &obj{V: 3} if !o.F() { - panic("pointer-reciever method failed") + panic("pointer-receiver method failed") } if !(*o).G() { panic("method call G failed") @@ -17,7 +17,7 @@ if !o.G() { panic("method promotion of G failed") } if !(*o).F() { - panic("pointer-reciever method promotion failed") + panic("pointer-receiver method promotion failed") } methodik intm int { diff --git a/format/format_test.go b/format/format_test.go index aca90f8..85799e8 100644 --- a/format/format_test.go +++ b/format/format_test.go @@ -66,7 +66,7 @@ func TestRoundTrip(t *testing.T) { } got := format.Stmt(s) if got != src { - t.Errorf("bad ouput: Expr(%q)=%q", src, got) + t.Errorf("bad output: Expr(%q)=%q", src, got) } } } @@ -110,7 +110,7 @@ func TestTypes(t *testing.T) { typ := s.(*stmt.TypeDecl).Type.Type got := format.Type(typ) if got != src { - t.Errorf("bad ouput: Type(%q)=%q", src, got) + t.Errorf("bad output: Type(%q)=%q", src, got) } } } diff --git a/ng.go b/ng.go index 66106ba..dd97d67 100644 --- a/ng.go +++ b/ng.go @@ -190,7 +190,7 @@ func initSession(ng *ngcore.Session) { // // Either way, instead of being one of those // obnoxious programs that refuses to respond - // to Ctrl-C, be overly agressive and let the + // to Ctrl-C, be overly aggressive and let the // entire ng process exit. // // This is bad if you use ng as your primary diff --git a/ngcore/ngcore.go b/ngcore/ngcore.go index 85008eb..b64ac6f 100644 --- a/ngcore/ngcore.go +++ b/ngcore/ngcore.go @@ -341,7 +341,7 @@ func (s *Session) Run(ctx context.Context, startInShell bool, sigint chan os.Sig case parser.StateCmdPartial: mode, prompt, history = "sh", "..$ ", s.History.Sh.src default: - return fmt.Errorf("unkown parser state: %v", state) + return fmt.Errorf("unknown parser state: %v", state) } s.Liner.SetMode(mode) data, err := s.Liner.Prompt(prompt) diff --git a/parser/parser.go b/parser/parser.go index 83704e3..eabbdd7 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -166,7 +166,7 @@ func (p *Parser) work() { // // The normal parser can take care of this, but we want to return // the parsed output of a top-level $$ before the entire expression - // is availble, so the REPL can evaluate as we go. That's what + // is available, so the REPL can evaluate as we go. That's what // makes a simple expression behave like an interactive shell. if p.res.State != StateCmd && p.s.Token == token.Shell { p.res.State = StateCmd diff --git a/typecheck/typecheck.go b/typecheck/typecheck.go index 470279c..2c60d25 100644 --- a/typecheck/typecheck.go +++ b/typecheck/typecheck.go @@ -934,7 +934,7 @@ func (c *Checker) checkCommaOK(e expr.Expr, partials []partial) []partial { // the general case for a map-index is to only typecheck // for returning the map-value. // in the case of indexing into a map with a comma-ok, - // we need to also return the boolean indicating whther + // we need to also return the boolean indicating whether // the key was found in the map. // so, replace the original tipe.Type with the tuple: // (tipe.Type, tipe.Bool)