在Go中解析时间字符串

The Spark Rest API returns time in this format: 2016-10-28T16:56:50.497GMT.

I'm trying to parse that in Go, without any luck. I keep getting 0001-01-01 00:00:00 +0000 UTC, but the time.Parse function doesn't throw any errors:

My function looks like this:

func getTime(timeStamp string) (t time.Time, e error) {
    t, e = time.Parse(
        time.RFC3339Nano,
        timeStamp)
    if e != nil {
        fmt.Errorf("Error parsing timestring", e)
    }
    return t, e
}

I've tried going through the documentation and created my custom layout, but I can't figure out how I should treat that GMT part of the string

You're trying to parse that time as time.RFC3339Nano, which it is not.

Use the format "2006-01-02T15:04:05.999MST"

https://play.golang.org/p/TYHnvclxEn