*: Fix go vet complaints (#1935)

* *: Fix go vet struct complaints

* *: Fix struct vet issue on linux

* *: Ignore proc/native in go vet check

We have to do some unsafe pointer manipulation that will never make go
vet happy within the proc/native package. Ignore it for runs of go vet.
This commit is contained in:
Derek Parker
2020-03-18 09:25:32 -07:00
committed by GitHub
parent edc5436fe3
commit ad75f78c4e
27 changed files with 166 additions and 136 deletions

View File

@ -253,7 +253,7 @@ func Test1NextGeneral(t *testing.T) {
ver, _ := goversion.Parse(runtime.Version())
if ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{1, 7, -1, 0, 0, ""}) {
if ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 7, Rev: -1}) {
testcases = []nextTest{
{17, 19},
{19, 20},
@ -433,7 +433,7 @@ func Test1ClientServer_infoLocals(t *testing.T) {
if state.Err != nil {
t.Fatalf("Unexpected error: %v, state: %#v", state.Err, state)
}
locals, err := c.ListLocalVariables(api.EvalScope{-1, 0, 0})
locals, err := c.ListLocalVariables(api.EvalScope{GoroutineID: -1})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
@ -461,7 +461,7 @@ func Test1ClientServer_infoArgs(t *testing.T) {
if regs == "" {
t.Fatal("Expected string showing registers values, got empty string")
}
locals, err := c.ListFunctionArgs(api.EvalScope{-1, 0, 0})
locals, err := c.ListFunctionArgs(api.EvalScope{GoroutineID: -1})
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
@ -687,7 +687,7 @@ func Test1ClientServer_EvalVariable(t *testing.T) {
t.Fatalf("Continue(): %v\n", state.Err)
}
var1, err := c.EvalVariable(api.EvalScope{-1, 0, 0}, "a1")
var1, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "a1")
assertNoError(err, t, "EvalVariable")
t.Logf("var1: %s", var1.SinglelineString())
@ -706,9 +706,9 @@ func Test1ClientServer_SetVariable(t *testing.T) {
t.Fatalf("Continue(): %v\n", state.Err)
}
assertNoError(c.SetVariable(api.EvalScope{-1, 0, 0}, "a2", "8"), t, "SetVariable()")
assertNoError(c.SetVariable(api.EvalScope{GoroutineID: -1}, "a2", "8"), t, "SetVariable()")
a2, err := c.EvalVariable(api.EvalScope{-1, 0, 0}, "a2")
a2, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "a2")
if err != nil {
t.Fatalf("Could not evaluate variable: %v", err)
}
@ -835,10 +835,10 @@ func Test1Issue355(t *testing.T) {
assertError(err, t, "ListThreads()")
_, err = c.GetThread(tid)
assertError(err, t, "GetThread()")
assertError(c.SetVariable(api.EvalScope{gid, 0, 0}, "a", "10"), t, "SetVariable()")
_, err = c.ListLocalVariables(api.EvalScope{gid, 0, 0})
assertError(c.SetVariable(api.EvalScope{GoroutineID: gid}, "a", "10"), t, "SetVariable()")
_, err = c.ListLocalVariables(api.EvalScope{GoroutineID: gid})
assertError(err, t, "ListLocalVariables()")
_, err = c.ListFunctionArgs(api.EvalScope{gid, 0, 0})
_, err = c.ListFunctionArgs(api.EvalScope{GoroutineID: gid})
assertError(err, t, "ListFunctionArgs()")
_, err = c.ListRegisters()
assertError(err, t, "ListRegisters()")
@ -846,9 +846,9 @@ func Test1Issue355(t *testing.T) {
assertError(err, t, "ListGoroutines()")
_, err = c.Stacktrace(gid, 10, false)
assertError(err, t, "Stacktrace()")
_, err = c.FindLocation(api.EvalScope{gid, 0, 0}, "+1")
_, err = c.FindLocation(api.EvalScope{GoroutineID: gid}, "+1")
assertError(err, t, "FindLocation()")
_, err = c.DisassemblePC(api.EvalScope{-1, 0, 0}, 0x40100, api.IntelFlavour)
_, err = c.DisassemblePC(api.EvalScope{GoroutineID: -1}, 0x40100, api.IntelFlavour)
assertError(err, t, "DisassemblePC()")
})
}
@ -863,12 +863,12 @@ func Test1Disasm(t *testing.T) {
state := <-ch
assertNoError(state.Err, t, "Continue()")
locs, err := c.FindLocation(api.EvalScope{-1, 0, 0}, "main.main")
locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "main.main")
assertNoError(err, t, "FindLocation()")
if len(locs) != 1 {
t.Fatalf("wrong number of locations for main.main: %d", len(locs))
}
d1, err := c.DisassemblePC(api.EvalScope{-1, 0, 0}, locs[0].PC, api.IntelFlavour)
d1, err := c.DisassemblePC(api.EvalScope{GoroutineID: -1}, locs[0].PC, api.IntelFlavour)
assertNoError(err, t, "DisassemblePC()")
if len(d1) < 2 {
t.Fatalf("wrong size of disassembly: %d", len(d1))
@ -876,7 +876,7 @@ func Test1Disasm(t *testing.T) {
pcstart := d1[0].Loc.PC
pcend := d1[len(d1)-1].Loc.PC + uint64(len(d1[len(d1)-1].Bytes))
d2, err := c.DisassembleRange(api.EvalScope{-1, 0, 0}, pcstart, pcend, api.IntelFlavour)
d2, err := c.DisassembleRange(api.EvalScope{GoroutineID: -1}, pcstart, pcend, api.IntelFlavour)
assertNoError(err, t, "DisassembleRange()")
if len(d1) != len(d2) {
@ -885,7 +885,7 @@ func Test1Disasm(t *testing.T) {
t.Fatal("mismatched length between disassemble pc and disassemble range")
}
d3, err := c.DisassemblePC(api.EvalScope{-1, 0, 0}, state.CurrentThread.PC, api.IntelFlavour)
d3, err := c.DisassemblePC(api.EvalScope{GoroutineID: -1}, state.CurrentThread.PC, api.IntelFlavour)
assertNoError(err, t, "DisassemblePC() - second call")
if len(d1) != len(d3) {
@ -934,7 +934,7 @@ func Test1Disasm(t *testing.T) {
state, err := c.StepInstruction()
assertNoError(err, t, fmt.Sprintf("StepInstruction() %d", count))
d3, err = c.DisassemblePC(api.EvalScope{-1, 0, 0}, state.CurrentThread.PC, api.IntelFlavour)
d3, err = c.DisassemblePC(api.EvalScope{GoroutineID: -1}, state.CurrentThread.PC, api.IntelFlavour)
assertNoError(err, t, fmt.Sprintf("StepInstruction() %d", count))
curinstr := getCurinstr(d3)
@ -1000,7 +1000,7 @@ func Test1ClientServer_CondBreakpoint(t *testing.T) {
state := <-c.Continue()
assertNoError(state.Err, t, "Continue()")
nvar, err := c.EvalVariable(api.EvalScope{-1, 0, 0}, "n")
nvar, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "n")
assertNoError(err, t, "EvalVariable()")
if nvar.SinglelineString() != "7" {
@ -1054,14 +1054,14 @@ func Test1TypesCommand(t *testing.T) {
func Test1Issue406(t *testing.T) {
withTestClient1("issue406", t, func(c *rpc1.RPCClient) {
locs, err := c.FindLocation(api.EvalScope{-1, 0, 0}, "issue406.go:146")
locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "issue406.go:146")
assertNoError(err, t, "FindLocation()")
_, err = c.CreateBreakpoint(&api.Breakpoint{Addr: locs[0].PC})
assertNoError(err, t, "CreateBreakpoint()")
ch := c.Continue()
state := <-ch
assertNoError(state.Err, t, "Continue()")
v, err := c.EvalVariable(api.EvalScope{-1, 0, 0}, "cfgtree")
v, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "cfgtree")
assertNoError(err, t, "EvalVariable()")
vs := v.MultilineString("")
t.Logf("cfgtree formats to: %s\n", vs)