Skip to content

Commit

Permalink
fix: add backward compatibility for Go 1.17 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x9ef committed Mar 30, 2023
1 parent 6606aed commit accb30d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/0x9ef/openai-go

go 1.19
go 1.17

require github.com/go-playground/validator/v10 v10.11.1

Expand Down
4 changes: 2 additions & 2 deletions openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ func (e *Engine) doReq(req *http.Request) (*http.Response, error) {
return resp, apiErr
}

func unmarshal(resp *http.Response, v any) error {
func unmarshal(resp *http.Response, v interface{}) error {
defer resp.Body.Close()
if err := json.NewDecoder(resp.Body).Decode(&v); err != nil {
return err
}
return nil
}

func marshalJson(body any) (io.Reader, error) {
func marshalJson(body interface{}) (io.Reader, error) {
b, err := json.Marshal(body)
if err != nil {
return nil, err
Expand Down

0 comments on commit accb30d

Please sign in to comment.