Skip to content

ArtifactVersion.CreateTime as float64 is ambiguous and non-idiomatic #685

@w1t

Description

@w1t

attrs.Created is a time.Time, but this converts it to float64(attrs.Created.Unix()) for ArtifactVersion.CreateTime. That drops sub-second precision, and the bigger issue is that CreateTime probably shouldn’t be a float64 in the first place. time.Time would be more idiomatic, or int64 if this is intended to store a Unix timestamp.

CreateTime: float64(attrs.Created.Unix()),

ArtifactVersion: &artifact.ArtifactVersion{
			Version:        version,
			CanonicalURI:   canonicalURI,
			CustomMetadata: customMeta,
			CreateTime:     float64(attrs.Created.Unix()), 
			MimeType:       attrs.ContentType,
		},

https://github.com/googleapis/google-cloud-go/blob/0b388a07dc2c2fcba5dbfca5a5641c38d1dc8067/storage/storage.go#L1612

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions