Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues found by goreportcard.com #244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion eval/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions eval/testdata/method5.ng
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions format/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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)
}
}
}
2 changes: 1 addition & 1 deletion ng.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ngcore/ngcore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion typecheck/typecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down