If no outline: present in document:
in template:
Parses the doc, but never finds DocumentTok. Continues to read until we get to EofTok, which returns. It returns no error and an empty Doc
We attempt to execute the template using the data in Doc. It's empty so it prints this error: # template: mdIndex:17:5: executing "mdIndex" at <.Name>: can't evaluate field Name in type *lib.Doc
in fmt:
doc is nil, and when we use MarshalIndent, it panics
potential solutions:
- if no DocumentTok is found, in other words, if
parser.read() never finds tok.Type DocumentTok, error saying the docs are ill-formatted and link to the readme.
or
- Check for
doc == nil before attempting to execute the template or marshal the data
If no
outline:present in document:in template:
Parses the doc, but never finds DocumentTok. Continues to
readuntil we get to EofTok, which returns. It returns no error and an empty DocWe attempt to execute the template using the data in Doc. It's empty so it prints this error:
# template: mdIndex:17:5: executing "mdIndex" at <.Name>: can't evaluate field Name in type *lib.Docin fmt:
docis nil, and when we use MarshalIndent, it panicspotential solutions:
parser.read()never finds tok.Type DocumentTok, error saying the docs are ill-formatted and link to the readme.or
doc == nilbefore attempting to execute the template or marshal the data