You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
encoding/jsonschema: fetch the test suite GitHub repo via a zip
Rather than `git clone` followed by `git checkout`, which is slower
and requires the VCS tool to be installed, we can directly download
a ZIP archive from GitHub via the documented API:
https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-zip
Note that this API is specific to GitHub, but practically every
VCS hosting service provides an extremely similar API.
As a bonus, fetching a ZIP means we can open it as an io/fs.FS directly
as long as we hold it all in memory, which is easy at the current size
of about 470KiB.
The runtime of this `go generate` step drops from about 1.5s
to about 1.2s on my laptop. As measured by the logger which now includes
precise timestamps, the fetching of the archive is now about 250ms,
now comparable to Go compilation at ~200ms and loading CUE at ~500ms.
While here, I noticed an unchecked error and a confusing error return
at the end of the function. Add a log line at the end too, to measure
how long the entire program took to do its job, as well as the filename
as the log prefix, so that the source is obvious in `go generate`.
I verified that it all works as expected by deleting the files
and re-generating and updating them from scratch.
The only changes are to stale skip strings, which Roger is fixing
in a parallel chain of CLs.
Signed-off-by: Daniel Martí <[email protected]>
Change-Id: Ia780ade3ca1ce27ef755a026f7545b173dafb17e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200925
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
0 commit comments