More efficient look for leading "{" symbold in stdin.go
This commit is contained in:
@@ -51,17 +51,11 @@ func (c *MyConfig) ParseStdin() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < len(buf); i++ {
|
buf = strings.TrimLeftFunc(buf, func(r rune) bool {
|
||||||
if strings.HasPrefix(buf, "{") {
|
return r != '{'
|
||||||
break
|
})
|
||||||
}
|
|
||||||
|
|
||||||
buf = buf[1:]
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(buf) == 0 {
|
|
||||||
log.Print("String from stdin has zero length, skipping")
|
|
||||||
|
|
||||||
|
if !strings.HasPrefix(buf, "{") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user