Currently the compiler will throw an error if the return value of append is not used, but it does not error or even warn if the return value of time.AppendFormat is not used, even though AppendFormat has the same semantics as append.
https://go.dev/play/p/IpxJrcX3FkT
If someone calls AppendFormat without using the return value, that is always an error, because it does nothing.
I looked for linters that would catch this issue and could not find any.
EDIT: I tried to add it to go vet unusedresult but I couldn't get it to work...is it that unusedresult still only works for pure functions as stated in #14972 ?
Currently the compiler will throw an error if the return value of
appendis not used, but it does not error or even warn if the return value oftime.AppendFormatis not used, even thoughAppendFormathas the same semantics asappend.https://go.dev/play/p/IpxJrcX3FkT
If someone calls AppendFormat without using the return value, that is always an error, because it does nothing.
I looked for linters that would catch this issue and could not find any.
EDIT: I tried to add it to
go vetunusedresultbut I couldn't get it to work...is it thatunusedresultstill only works for pure functions as stated in #14972 ?