1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-06-27 00:21:07 +02:00

Fixed a few fmt and debug outputs

This commit is contained in:
Andy Grunwald
2016-10-03 13:33:46 +02:00
parent 8d3b47871f
commit 31508ce192
6 changed files with 95 additions and 119 deletions

View File

@ -4,14 +4,15 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/fatih/structs"
"github.com/trivago/tgo/tcontainer"
"io"
"mime/multipart"
"net/url"
"reflect"
"strings"
"time"
"github.com/fatih/structs"
"github.com/trivago/tgo/tcontainer"
)
const (
@ -102,6 +103,8 @@ type IssueFields struct {
Unknowns tcontainer.MarshalMap
}
// MarshalJSON is a custom JSON marshal function for the IssueFields structs.
// It handles JIRA custom fields and maps those from / to "Unknowns" key.
func (i *IssueFields) MarshalJSON() ([]byte, error) {
m := structs.Map(i)
unknowns, okay := m["Unknowns"]
@ -115,6 +118,8 @@ func (i *IssueFields) MarshalJSON() ([]byte, error) {
return json.Marshal(m)
}
// UnmarshalJSON is a custom JSON marshal function for the IssueFields structs.
// It handles JIRA custom fields and maps those from / to "Unknowns" key.
func (i *IssueFields) UnmarshalJSON(data []byte) error {
// Do the normal unmarshalling first