sahilm/yamldiff

Is the stat(...) call really necessary?

Closed this issue · 1 comments

From what I understand, stat(...) is only used to check that a file exist. But really,

yamldiff/main.go

Lines 45 to 52 in 3a067f1

yaml1, err := unmarshal(opts.File1)
if err != nil {
failOnErr(formatter, err)
}
yaml2, err := unmarshal(opts.File2)
if err != nil {
failOnErr(formatter, err)
}
will fail if any of the files don't exist. Additionally, https://github.com/sahilm/yamldiff/blob/master/main.go#L80 will fail in other ways, such as read permissions being incorrect.

sahilm commented

I want to fail with a good error message.