mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 12:43:30 +02:00
23 lines
380 B
Go
23 lines
380 B
Go
package jira
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
"io/ioutil"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func readJSON(input io.Reader, data interface{}) error {
|
|
content, err := ioutil.ReadAll(input)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = json.Unmarshal(content, data)
|
|
if err != nil {
|
|
return errors.Wrap(err, fmt.Sprintf("JSON Parse Error: %s from %s", err, content))
|
|
}
|
|
return nil
|
|
}
|