go-shiori / go-epub

Go library for creating EPUB files
MIT License
37 stars 7 forks source link

Remove all golangci-error #5

Closed Monirzadeh closed 1 year ago

Monirzadeh commented 1 year ago

this Pull request try to fix error of golangci in code to be update to golang 1.20

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 6150601568


Files with Coverage Reduction New Missed Lines %
fetchmedia.go 3 93.28%
epub.go 34 85.34%
<!-- Total: 37 -->
Totals Coverage Status
Change from base Build 6135742601: 0.0%
Covered Lines: 1074
Relevant Lines: 1233

💛 - Coveralls
Monirzadeh commented 1 year ago

Hi @bmaupin do you know why we have this line in project but not use that? https://github.com/go-shiori/go-epub/blob/dc41032709c02171defc7dfa8bce83ce75ca0c79/toc.go#L237C1-L239C2

Monirzadeh commented 1 year ago

Hi @fmartingr. i try to not change code so much and follow same error handling in each individual function. but if you think we should change them to better option please leave comment on them. for example i use fatal one or two function do you think we should replace them?

fmartingr commented 1 year ago

Hi @fmartingr. i try to not change code so much and follow same error handling in each individual function. but if you think we should change them to better option please leave comment on them. for example i use fatal one or two function do you think we should replace them?

I think those t.Fatal are ok, since they are failing in system calls (like copy, create temp, etc.). If that calls fails there's a high change that something is wrong at another level anyway. If we put t.Error in io.Copy for example, there's a chance that all calls to that are going to fail because of the same reason, so it's better to fail early I think.

Monirzadeh commented 1 year ago

Thanks. i just don't know why we have this in code but i don't remove that. https://github.com/go-shiori/go-epub/pull/5#issuecomment-1714543835