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