*: consolidate appends where possible

This commit is contained in:
Derek Parker 2020-03-18 15:45:29 -07:00 committed by Alessandro Arzilli
parent 65d7f5c65f
commit 731a7fc125
8 changed files with 38 additions and 37 deletions

1
go.mod

@ -4,6 +4,7 @@ go 1.11
require (
github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5
github.com/cpuguy83/go-md2man v1.0.10 // indirect
github.com/google/go-dap v0.2.0
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561

4
go.sum

@ -1,5 +1,7 @@
github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5 h1:rIXlvz2IWiupMFlC45cZCXZFvKX/ExBcSLrDy2G0Lp8=
github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5/go.mod h1:p/NrK5tF6ICIly4qwEDsf6VDirFiWWz0FenfYBwJaKQ=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
@ -32,6 +34,8 @@ github.com/pkg/profile v0.0.0-20170413231811-06b906832ed0 h1:wBza4Dlm/NCQF572oSG
github.com/pkg/profile v0.0.0-20170413231811-06b906832ed0/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sirupsen/logrus v0.0.0-20180523074243-ea8897e79973 h1:3AJZYTzw3gm3TNTt30x0CCKD7GOn2sdd50Hn35fQkGY=
github.com/sirupsen/logrus v0.0.0-20180523074243-ea8897e79973/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372 h1:eRfW1vRS4th8IX2iQeyqQ8cOUNOySvAYJ0IUvTXGoYA=

@ -371,8 +371,7 @@ func LLDBLaunch(cmd []string, wd string, foreground bool, debugInfoDirs []string
}
port = unusedPort()
args := make([]string, 0, len(cmd)+3)
args = append(args, "gdbserver")
args = append(args, port, "--")
args = append(args, "gdbserver", port, "--")
args = append(args, cmd...)
process = exec.Command("lldb-server", args...)

@ -1043,8 +1043,7 @@ func (conn *gdbConn) send(cmd []byte) error {
// append checksum to packet
cmd = append(cmd, '#')
sum := checksum(cmd)
cmd = append(cmd, hexdigit[sum>>4])
cmd = append(cmd, hexdigit[sum&0xf])
cmd = append(cmd, hexdigit[sum>>4], hexdigit[sum&0xf])
attempt := 0
for {

@ -1529,8 +1529,7 @@ func (v *Variable) loadMap(recurseLevel int, cfg LoadConfig) {
if key.Unreadable != nil || val.Unreadable != nil {
errcount++
}
v.Children = append(v.Children, *key)
v.Children = append(v.Children, *val)
v.Children = append(v.Children, *key, *val)
count++
if errcount > maxErrCount {
break

@ -387,40 +387,41 @@ For example:
}
if client == nil || client.Recorded() {
c.cmds = append(c.cmds, command{
aliases: []string{"rewind", "rw"},
group: runCmds,
cmdFn: c.rewind,
helpMsg: "Run backwards until breakpoint or program termination.",
})
c.cmds = append(c.cmds, command{
aliases: []string{"check", "checkpoint"},
cmdFn: checkpoint,
helpMsg: `Creates a checkpoint at the current position.
c.cmds = append(c.cmds,
command{
aliases: []string{"rewind", "rw"},
group: runCmds,
cmdFn: c.rewind,
helpMsg: "Run backwards until breakpoint or program termination.",
},
command{
aliases: []string{"check", "checkpoint"},
cmdFn: checkpoint,
helpMsg: `Creates a checkpoint at the current position.
checkpoint [note]
The "note" is arbitrary text that can be used to identify the checkpoint, if it is not specified it defaults to the current filename:line position.`,
})
c.cmds = append(c.cmds, command{
aliases: []string{"checkpoints"},
cmdFn: checkpoints,
helpMsg: "Print out info for existing checkpoints.",
})
c.cmds = append(c.cmds, command{
aliases: []string{"clear-checkpoint", "clearcheck"},
cmdFn: clearCheckpoint,
helpMsg: `Deletes checkpoint.
},
command{
aliases: []string{"checkpoints"},
cmdFn: checkpoints,
helpMsg: "Print out info for existing checkpoints.",
},
command{
aliases: []string{"clear-checkpoint", "clearcheck"},
cmdFn: clearCheckpoint,
helpMsg: `Deletes checkpoint.
clear-checkpoint <id>`,
})
c.cmds = append(c.cmds, command{
aliases: []string{"rev"},
group: runCmds,
cmdFn: c.revCmd,
helpMsg: `Reverses the execution of the target program for the command specified.
},
command{
aliases: []string{"rev"},
group: runCmds,
cmdFn: c.revCmd,
helpMsg: `Reverses the execution of the target program for the command specified.
Currently, only the rev step-instruction command is supported.`,
})
})
for i := range c.cmds {
v := &c.cmds[i]
if v.match("restart") {

@ -275,8 +275,7 @@ func testFlags() []string {
testFlags = append(testFlags, "-v")
}
if NOTimeout {
testFlags = append(testFlags, "-timeout")
testFlags = append(testFlags, "0")
testFlags = append(testFlags, "-timeout", "0")
}
if runtime.GOOS == "darwin" {
testFlags = append(testFlags, "-exec="+wd+"/scripts/testsign")

@ -138,8 +138,7 @@ func readRegex(in string) (rx string, rest string) {
if ch == '/' {
out = append(out, '/')
} else {
out = append(out, '\\')
out = append(out, ch)
out = append(out, '\\', ch)
}
escaped = false
} else {