Remove unnecessary indirection
This commit is contained in:
parent
ab685cfe04
commit
62e7037f20
2 changed files with 9 additions and 9 deletions
|
|
@ -289,7 +289,7 @@ func (wk *worker) runIterator(it graph.Iterator) {
|
||||||
}
|
}
|
||||||
tags := make(map[string]graph.Value)
|
tags := make(map[string]graph.Value)
|
||||||
it.TagResults(tags)
|
it.TagResults(tags)
|
||||||
if !wk.send(&Result{actualResults: &tags}) {
|
if !wk.send(&Result{actualResults: tags}) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for it.NextPath() {
|
for it.NextPath() {
|
||||||
|
|
@ -300,7 +300,7 @@ func (wk *worker) runIterator(it graph.Iterator) {
|
||||||
}
|
}
|
||||||
tags := make(map[string]graph.Value)
|
tags := make(map[string]graph.Value)
|
||||||
it.TagResults(tags)
|
it.TagResults(tags)
|
||||||
if !wk.send(&Result{actualResults: &tags}) {
|
if !wk.send(&Result{actualResults: tags}) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ type Result struct {
|
||||||
metaresult bool
|
metaresult bool
|
||||||
err error
|
err error
|
||||||
val *otto.Value
|
val *otto.Value
|
||||||
actualResults *map[string]graph.Value
|
actualResults map[string]graph.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) ToggleDebug() {
|
func (s *Session) ToggleDebug() {
|
||||||
|
|
@ -179,9 +179,9 @@ func (s *Session) ToText(result interface{}) string {
|
||||||
out = fmt.Sprintln("****")
|
out = fmt.Sprintln("****")
|
||||||
if data.val == nil {
|
if data.val == nil {
|
||||||
tags := data.actualResults
|
tags := data.actualResults
|
||||||
tagKeys := make([]string, len(*tags))
|
tagKeys := make([]string, len(tags))
|
||||||
i := 0
|
i := 0
|
||||||
for k, _ := range *tags {
|
for k, _ := range tags {
|
||||||
tagKeys[i] = k
|
tagKeys[i] = k
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ func (s *Session) ToText(result interface{}) string {
|
||||||
if k == "$_" {
|
if k == "$_" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
out += fmt.Sprintf("%s : %s\n", k, s.ts.NameOf((*tags)[k]))
|
out += fmt.Sprintf("%s : %s\n", k, s.ts.NameOf(tags[k]))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if data.val.IsObject() {
|
if data.val.IsObject() {
|
||||||
|
|
@ -214,15 +214,15 @@ func (s *Session) BuildJson(result interface{}) {
|
||||||
if data.val == nil {
|
if data.val == nil {
|
||||||
obj := make(map[string]string)
|
obj := make(map[string]string)
|
||||||
tags := data.actualResults
|
tags := data.actualResults
|
||||||
tagKeys := make([]string, len(*tags))
|
tagKeys := make([]string, len(tags))
|
||||||
i := 0
|
i := 0
|
||||||
for k, _ := range *tags {
|
for k, _ := range tags {
|
||||||
tagKeys[i] = k
|
tagKeys[i] = k
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
sort.Strings(tagKeys)
|
sort.Strings(tagKeys)
|
||||||
for _, k := range tagKeys {
|
for _, k := range tagKeys {
|
||||||
obj[k] = s.ts.NameOf((*tags)[k])
|
obj[k] = s.ts.NameOf(tags[k])
|
||||||
}
|
}
|
||||||
s.dataOutput = append(s.dataOutput, obj)
|
s.dataOutput = append(s.dataOutput, obj)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue