schmorrison / Zoho

Golang API for Zoho services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bugs in zoho.Time and crm.SingleLine marshalling

rollulus opened this issue · comments

Not affecting me, but I ran into it while creating my PR, and I thought that you might wanted to know this. In the following snippet:

// UnmarshalJSON is the json unmarshalling function for Time internal type
func (t *Time) UnmarshalJSON(b []byte) error {
	s := strings.Trim(string(b), "\"")
	if s == "null" {
		blank := Time(time.Time{})
		t = &blank
		return nil
	}
	pTime, err := time.Parse(zohoTimeLayout, s)
	if err == nil {
		ref := Time(pTime)
		t = &ref
	}
	return err
}

t = &blank and t = &ref are ineffective. It has no effect to modify the receiver t. It does have effect to modify the value to which the receiver points. That would make e.g. *t = blank and *t = ref.

Good catch. That stuff was done at the tail of a sprint a couple years ago I think. I don't believe I am using those types in the packages at all.

BTW thanks for the PR