cmd/cue: get go: support time.Duration
Fix `get go` behavior with `time.Duration` to output valid CUE.
Convert the underlying numeric to string, and add the unit suffix so
it's compliant with CUE's `time.Duration`.
Add `Duration` to the `time` built-in check so we render as
`time.Duration` rather than the invalid `time.#Duration`.
Run the valid nanosecond `Duration` str through `time.ParseDuration` and
use its `String()` output so the CUE is human-readable.
Fixes #2969.
Signed-off-by: Greg Dallavalle <greg.dallavalle@gmail.com>
Change-Id: I4b69e30a2a679643ea80854fe2b01f5794d94b71
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1189718
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@gmail.com>
authored by