Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong FileInfo.modTime generation #10

Closed
dmke opened this issue Sep 4, 2017 · 0 comments
Closed

Wrong FileInfo.modTime generation #10

dmke opened this issue Sep 4, 2017 · 0 comments

Comments

@dmke
Copy link
Contributor

dmke commented Sep 4, 2017

Hi,

I've noticed a small issue with the FileInfo.modTime generation. It is a bit annoying because it prevents proper client-side caching when serving the contents via HTTP.

In the generated file, I find this entry:

FileInfo{
	modTime: time.Unix(1504547519, 1504547519143839891),
	// etc.
}

However, time.Unix will return 2065-05-09T12:43:58+01:00, the correct value (ignoring time zones) is:

$ stat -c %y ui/build/style.css
2017-09-04 19:51:59.143839891 +0200

While the documentation of time.Unix states

It is valid to pass nsec outside the range [0, 999999999]

it does not mention the implementation detail that it adds nsec / 1e9 to the sec value. Hence the generated FileInfo should be in either of these forms:

time.Unix(0, 1504547519143839891) // 0, nsec
time.Unix(1504547519, 143839891)  // nsec/1e9, nsec%1e9

I believe the first form should work on any Go release (the crucial part in the implementation of Go1 and Go1.9 has stayed the same).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant