Skip to content

Commit 7bea4c3

Browse files
committed
Fix errors spotted by go vet
1 parent 648fc13 commit 7bea4c3

File tree

6 files changed

+214
-207
lines changed

6 files changed

+214
-207
lines changed

compile/compile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ func (c *compiler) getRefType(name string) symtable.Scope {
413413
}
414414
scope := c.SymTable.GetScope(name)
415415
if scope == symtable.ScopeInvalid {
416-
panic(fmt.Sprintf("compile: getRefType: unknown scope for %s in %s\nsymbols: %s\nlocals: %s\nglobals: %s", name, c.Code.Name, c.SymTable.Symbols, c.Code.Varnames, c.Code.Names))
416+
panic(fmt.Sprintf("compile: getRefType: unknown scope for %s in %s\nsymbols: %v\nlocals: %s\nglobals: %s", name, c.Code.Name, c.SymTable.Symbols, c.Code.Varnames, c.Code.Names))
417417
}
418418
return scope
419419
}

main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,18 @@ func main() {
7878
// FIXME should be using ImportModuleLevelObject() here
7979
f, err := os.Open(prog)
8080
if err != nil {
81-
log.Fatal("Failed to open %q: %v", prog, err)
81+
log.Fatalf("Failed to open %q: %v", prog, err)
8282
}
8383
var obj py.Object
8484
if strings.HasSuffix(prog, ".pyc") {
8585
obj, err = marshal.ReadPyc(f)
8686
if err != nil {
87-
log.Fatal("Failed to marshal %q: %v", prog, err)
87+
log.Fatalf("Failed to marshal %q: %v", prog, err)
8888
}
8989
} else if strings.HasSuffix(prog, ".py") {
9090
str, err := ioutil.ReadAll(f)
9191
if err != nil {
92-
log.Fatal("Failed to read %q: %v", prog, err)
92+
log.Fatalf("Failed to read %q: %v", prog, err)
9393
}
9494
obj, err = compile.Compile(string(str), prog, "exec", 0, true)
9595
if err != nil {

marshal/marshal.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func (rfile *rFile) ReadObject() (obj py.Object, err error) {
325325
fmt.Printf("Returning None as %d/%d out of range\n", n, len(rfile.refs))
326326
return py.None, nil
327327

328-
return nil, fmt.Errorf("TYPE_REF (out of range) - %d vs %d: %#v", n, len(rfile.refs), rfile.refs)
328+
// return nil, fmt.Errorf("TYPE_REF (out of range) - %d vs %d: %#v", n, len(rfile.refs), rfile.refs)
329329
}
330330
AddRef = false
331331
return rfile.refs[n], nil

notes.txt

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ Code Quality
77
Limitations
88
===========
99
* string keys only in dictionaries
10+
* intermediate fix - stop it panicing!
11+
* line numbers missing in SyntaxErrors
12+
* \N{...} escapes not implemented
13+
* Interactive interpreter does single lines only
14+
* compile(..., "single") not working
15+
* string[x] wrong for unicode strings (easy fix)
16+
* lots of builtins still to implement
1017

1118
Todo
1219
====

0 commit comments

Comments
 (0)