From badb0e75638853e7a7faff803b0b9d5d1b7b591c Mon Sep 17 00:00:00 2001 From: "Vojtech Vitek (golang.cz)" Date: Tue, 23 Apr 2024 16:12:05 +0200 Subject: [PATCH] Fix .Causef() syntax error (shadowed fmt pkg name) (#66) fmt.Errorf undefined (type string has no field or method Errorf) --- _examples/golang-basics/example.gen.go | 4 ++-- _examples/golang-imports/api.gen.go | 4 ++-- errors.go.tmpl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_examples/golang-basics/example.gen.go b/_examples/golang-basics/example.gen.go index bc4a298..ec0f14f 100644 --- a/_examples/golang-basics/example.gen.go +++ b/_examples/golang-basics/example.gen.go @@ -864,8 +864,8 @@ func (e WebRPCError) WithCause(cause error) WebRPCError { return err } -func (e WebRPCError) WithCausef(fmt string, args ...interface{}) WebRPCError { - cause := fmt.Errorf(fmt, args...) +func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError { + cause := fmt.Errorf(format, args...) err := e err.cause = cause err.Cause = cause.Error() diff --git a/_examples/golang-imports/api.gen.go b/_examples/golang-imports/api.gen.go index f16d9bc..ec63284 100644 --- a/_examples/golang-imports/api.gen.go +++ b/_examples/golang-imports/api.gen.go @@ -574,8 +574,8 @@ func (e WebRPCError) WithCause(cause error) WebRPCError { return err } -func (e WebRPCError) WithCausef(fmt string, args ...interface{}) WebRPCError { - cause := fmt.Errorf(fmt, args...) +func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError { + cause := fmt.Errorf(format, args...) err := e err.cause = cause err.Cause = cause.Error() diff --git a/errors.go.tmpl b/errors.go.tmpl index 4a1478c..7df32fd 100644 --- a/errors.go.tmpl +++ b/errors.go.tmpl @@ -58,8 +58,8 @@ func (e WebRPCError) WithCause(cause error) WebRPCError { return err } -func (e WebRPCError) WithCausef(fmt string, args ...interface{}) WebRPCError { - cause := fmt.Errorf(fmt, args...) +func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError { + cause := fmt.Errorf(format, args...) err := e err.cause = cause err.Cause = cause.Error()