3 ms·
Go will most certainly notify you if a 3rd party API suddenly returns a new error. Typically you would see an assignment mismatch.
by usddddd 7y ago
Go will most certainly notify you if a 3rd party API suddenly returns a new error. Typically you would see an assignment mismatch.
- deleted 7y ago[deleted]
- munk-a 7y agoWon't this only cause an assignment mismatch if the function previously returns values that you captured? For functions that previously had no return value and suddenly have a return value (so those side effect only functions) I believe golang won't complain?
- hota_mazi 7y agoNo, it won't. If a function could return one error but in a new version, it can now return two types of error, the Go compiler will not notify you. And your code is now failing to handle an error case.
- masklinn 7y agoThe only situation in which that will happen is a function going from returning a value to returning a value and an error and you were actually getting & using the value. If a function starts returning more variable errors Go likely won’t tell you (though in fairness that’s a pretty common issue). If a function was not returning anything or you did not care for the value it returned, it adding an error will be a completely invisible event.