3 ms·
Because I want to know what function does?
by notpushkin 4y ago
Because I want to know what function does?
- Thaxll 4y agoI think it's not possible to achieve with func name on its own, the closest thing I see would be comments on the function but again not reliable imo.
- throwaway2203 4y agoAbsolutely not reliable. Comments get stale faster than anything else in the codebase.
- wizhi 4y agoAssuming Car() is a receiver function, you should be able to infer "how" the Car is "fetched" based on the type receiving the function call. func (d CarDB) func Car() (Car, error) The above tells you everything you need to know. As for usage, again, the type and now also the variable names should let you infer everything you need. func f(db *CarDB) { c, _ := db.Car() } The function name makes as little of a guarantee as to the underlying "how" as these other factors.