Skip to content

Commit b942cac

Browse files
committed
fix vet errors
1 parent f5e2397 commit b942cac

13 files changed

+20
-22
lines changed

Diff for: .travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ go:
77

88
before_install:
99
- go get github.com/axw/gocov/gocov
10-
- go get github.com/yuin/goveralls
10+
- go get github.com/mattn/goveralls
1111
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
1212
install:
1313
- go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v gopher-lua)
1414
script:
15-
- $HOME/gopath/bin/goveralls -service=travis-ci -vetoff
15+
- $HOME/gopath/bin/goveralls -service=travis-ci

Diff for: _state.go

-1
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,6 @@ func (ls *LState) Get(idx int) LValue {
10541054
return LNil
10551055
}
10561056
}
1057-
return LNil
10581057
}
10591058

10601059
func (ls *LState) Push(value LValue) {

Diff for: _vm.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,9 @@ func init() {
612612
cf.Pc = 0
613613
cf.Base = RA
614614
cf.LocalBase = RA + 1
615-
cf.ReturnBase = cf.ReturnBase
615+
// cf.ReturnBase = cf.ReturnBase
616616
cf.NArgs = nargs
617-
cf.NRet = cf.NRet
617+
// cf.NRet = cf.NRet
618618
cf.TailCall++
619619
lbase := cf.LocalBase
620620
if meta {
@@ -855,7 +855,6 @@ func numberArith(L *LState, opcode int, lhs, rhs LNumber) LNumber {
855855
return LNumber(math.Pow(flhs, frhs))
856856
}
857857
panic("should not reach here")
858-
return LNumber(0)
859858
}
860859

861860
func objectArith(L *LState, opcode int, lhs, rhs LValue) LValue {

Diff for: channellib.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ func channelSelect(L *LState) int {
4646
cases := make([]reflect.SelectCase, L.GetTop())
4747
top := L.GetTop()
4848
for i := 0; i < top; i++ {
49-
cas := reflect.SelectCase{reflect.SelectSend, reflect.ValueOf(nil), reflect.ValueOf(nil)}
49+
cas := reflect.SelectCase{
50+
Dir: reflect.SelectSend,
51+
Chan: reflect.ValueOf(nil),
52+
Send: reflect.ValueOf(nil),
53+
}
5054
tbl := L.CheckTable(i + 1)
5155
dir, ok1 := tbl.RawGetInt(1).(LString)
5256
if !ok1 {

Diff for: cmd/glua/glua.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ Available options are:
3636
-dc dump VM codes
3737
-i enter interactive mode after executing 'script'
3838
-p file write cpu profiles to the file
39-
-v show version information
40-
`)
39+
-v show version information`)
4140
}
4241
flag.Parse()
4342
if len(opt_p) != 0 {

Diff for: compile.go

-3
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,6 @@ func compileExpr(context *funcContext, reg int, expr ast.Expr, ec *expcontext) i
10481048
panic(fmt.Sprintf("expr %v not implemented.", reflect.TypeOf(ex).Elem().Name()))
10491049
}
10501050

1051-
panic("should not reach here")
1052-
return sused
10531051
} // }}}
10541052

10551053
func compileExprWithPropagation(context *funcContext, expr ast.Expr, reg *int, save *int, propergator func(int, *int, *int, int)) { // {{{
@@ -1108,7 +1106,6 @@ func constFold(exp ast.Expr) ast.Expr { // {{{
11081106

11091107
return exp
11101108
}
1111-
return exp
11121109
} // }}}
11131110

11141111
func compileFunctionExpr(context *funcContext, funcexpr *ast.FunctionExpr, ec *expcontext) { // {{{

Diff for: parse/lexer.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ type Scanner struct {
4949

5050
func NewScanner(reader io.Reader, source string) *Scanner {
5151
return &Scanner{
52-
Pos: ast.Position{source, 1, 0},
52+
Pos: ast.Position{
53+
Source: source,
54+
Line: 1,
55+
Column: 0,
56+
},
5357
reader: bufio.NewReaderSize(reader, 4096),
5458
}
5559
}

Diff for: pm/pm.go

-1
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ redo:
600600
goto redo
601601
}
602602
panic("should not reach here")
603-
return false, sp, m
604603
}
605604

606605
/* }}} */

Diff for: script_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func testScriptCompile(t *testing.T, script string) {
5454
t.Fatal(err3)
5555
return
5656
}
57-
proto.String()
57+
nop := func(s string) {}
58+
nop(proto.String())
5859
}
5960

6061
func testScriptDir(t *testing.T, tests []string, directory string) {

Diff for: state.go

-1
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,6 @@ func (ls *LState) Get(idx int) LValue {
11391139
return LNil
11401140
}
11411141
}
1142-
return LNil
11431142
}
11441143

11451144
func (ls *LState) Push(value LValue) {

Diff for: state_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ func TestPCall(t *testing.T) {
241241
defer L.Close()
242242
L.Register("f1", func(L *LState) int {
243243
panic("panic!")
244-
return 0
245244
})
246245
errorIfScriptNotFail(t, L, `f1()`, "panic!")
247246
L.Push(L.GetGlobal("f1"))
@@ -259,7 +258,6 @@ func TestPCall(t *testing.T) {
259258

260259
err = L.PCall(0, 0, L.NewFunction(func(L *LState) int {
261260
panic("panicc!")
262-
return 1
263261
}))
264262
errorIfFalse(t, strings.Contains(err.Error(), "panicc!"), "")
265263
}

Diff for: utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,6 @@ func strCmp(s1, s2 string) int {
257257

258258
func unsafeFastStringToReadOnlyBytes(s string) []byte {
259259
sh := (*reflect.StringHeader)(unsafe.Pointer(&s))
260-
bh := reflect.SliceHeader{sh.Data, sh.Len, sh.Len}
260+
bh := reflect.SliceHeader{Data: sh.Data, Len: sh.Len, Cap: sh.Len}
261261
return *(*[]byte)(unsafe.Pointer(&bh))
262262
}

Diff for: vm.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,9 @@ func init() {
774774
cf.Pc = 0
775775
cf.Base = RA
776776
cf.LocalBase = RA + 1
777-
cf.ReturnBase = cf.ReturnBase
777+
// cf.ReturnBase = cf.ReturnBase
778778
cf.NArgs = nargs
779-
cf.NRet = cf.NRet
779+
// cf.NRet = cf.NRet
780780
cf.TailCall++
781781
lbase := cf.LocalBase
782782
if meta {
@@ -1226,7 +1226,6 @@ func numberArith(L *LState, opcode int, lhs, rhs LNumber) LNumber {
12261226
return LNumber(math.Pow(flhs, frhs))
12271227
}
12281228
panic("should not reach here")
1229-
return LNumber(0)
12301229
}
12311230

12321231
func objectArith(L *LState, opcode int, lhs, rhs LValue) LValue {

0 commit comments

Comments
 (0)