猿问

无法访问/投射时间。时间

使用https://github.com/andygrunwald/go-jira时:


问题 - 解决日期定义为


struct {

  ...

  Resolutiondate                Time              `json:"resolutiondate,omitempty" structs:"resolutiondate,omitempty"`

  ...

}


type Time time.Time

尝试访问使用 github.com/spf13/cast


var resDate time.Time

resDate, err = cast.ToTimeE(issue.Fields.Resolutiondate)

我得到:


err = "unable to cast jira.Time{wall:0x0, ext:63694019156, loc:(*time.Location)(0xe10a80)} of type jira.Time to Time"

或者在尝试施放时,我遇到施放违规


resDate = issue.Fields.Resolutiondate.(time.Time)

(试图将 Resolutiondate 的类型更改为 time.Time,但得到一个 html 响应转换错误...)


翻过高山走不出你
浏览 108回答 1
1回答

慕田峪4524236

我非常确定我测试过: resDate=time.Time(issue.Fields.ResolutionDate) 感谢您的帮助
随时随地看视频慕课网APP

相关分类

Go
我要回答