[Golang] Move utility functions from client.mustache to utils.mustache (#19001)

* [Golang] Move utility functions from client.mustache to utils.mustache

* re-generate Go samples

* re-generate Go samples again

* re-generate samples once more

* update go samples

---------

Co-authored-by: Martin Lakov <martin.lakov@ocado.com>
This commit is contained in:
William Cheng
2024-06-24 11:58:57 +08:00
committed by GitHub
parent 1064cb6a68
commit d5f42500ab
19 changed files with 131 additions and 108 deletions

View File

@@ -519,18 +519,6 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
// A wrapper for strict JSON decoding
func newStrictDecoder(data []byte) *json.Decoder {
dec := json.NewDecoder(bytes.NewBuffer(data))
dec.DisallowUnknownFields()
return dec
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {