Closed taylorkline closed 5 years ago
The error isn't populated if the filetype is unknown. In that case filetype.Unknown is returned and err==nil. An error is only returned if an error occurs. You're correct that this example is wrong though:
kind, unknown := filetype.Match(buf)
if unknown != nil {
fmt.Printf("Unknown: %s", unknown)
return
}
I submitted #59 to correct that
Should be fixed now. Thanks!
Expected behavior:
We would expect
err != nil
, but this is not so.The documentation appears to contradict itself. In one example, we have:
Yet, in another example, we have:
I would expect the documentation to be consistent and the error to be populated if we have an unknown filetype.