inancgumus/learngo · error
wrong input: %v (line #%d)
Error message
wrong input: %v (line #%d)
What it means
Pointer-based parse() returning *parser from newParser(): rejects lines whose field count is not exactly two; the error is recorded in p.lerr, freezing the parser so later lines are ignored. The line counter p.lines reflects the current (offending) line.
Source
Thrown at 26-pointers/05-log-parser-pointers-vs-values/parser.go:48
p.lines++
fields := strings.Fields(line)
if len(fields) != 2 {
p.lerr = fmt.Errorf("wrong input: %v (line #%d)", fields, p.lines)
return
}
var err error
r.domain = fields[0]View on GitHub (pinned to 3c475a78e5)
Solutions
- Inspect p.lerr after the parse loop and report the bad line.
- Pre-filter the log to remove lines lacking exactly two columns.
- Fix the offending line in the input file.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at 26-pointers/05-log-parser-pointers-vs-values/parser.go:48 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of inancgumus/learngo@3c475a78e5 (2026-09-02).
Data as JSON: /api/errors/65cd71440e183f83.
Report an issue: GitHub.