Maybe fmt.Errorf encourages fmt.Errorf("%v %v", false, 42) Or worse fmt.Errorf("error %v %v", false, 42)
:-) On Sun, Dec 30, 2018, 1:07 AM Jakob Borg <ja...@kastelo.net wrote: > I would suggest that an error should start with a descriptive string. The > existing methods encourage this. A fmt.Error as suggested would not, > instead implicitly encouraging things like fmt.Error(false, 42) which is > user unfriendly. > > //jb > > On 30 Dec 2018, at 09:53, Justin Israel <justinisr...@gmail.com> wrote: > > > > On Sun, Dec 30, 2018 at 9:26 PM Liam Breck <networkimp...@gmail.com> > wrote: > >> Justin, see docs for fmt.Print(...interface{}) >> > > Ah true. I forgot about the whitespace formatting versions. I stand > corrected that a fmt.Error would actually perform formatting and would be > consistent with Sprint and Print. My only guess now is that it *could* have > been in the errors package if the errors package had been created at the > same time as the fmt package, but it was added later after fmt.Errorf > already existed. > > >> >> On Sun, Dec 30, 2018, 12:15 AM Justin Israel <justinisr...@gmail.com >> wrote: >> >>> >>> >>> On Sun, Dec 30, 2018, 7:24 PM Liam Breck <networkimp...@gmail.com> >>> wrote: >>> >>>> What's the rationale for omission of: >>>> fmt.Error(a ...interface{}) error >>>> >>> >>> What does it mean for this function to accept a variable number of >>> arguments when there is no formatting or printing implied by the name of >>> the function? >>> >>> >>>> Given that other fmt functions come in that variety? >>>> >>> >>> The other functions in the fmt package do some kind of formatting with >>> the arguments (newlines, format string) >>> >>> >>>> I realize it can be achieved like this, but so can fmt.Errorf >>>> errors.New(fmt.Sprint(...)) >>>> >>>> Would a proposal to add it be entertained? >>>> >>> >>> I have a feeling it wouldn't be accepted since it would just duplicate >>> the functionality of errors.New() and it doesn't provide any extra >>> formatting functionality. >>> >>> >>>> Happy New Year to all :-) >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "golang-nuts" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to golang-nuts+unsubscr...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.