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

update cache and lockedfile packages #218

Merged
merged 2 commits into from
May 15, 2023
Merged

update cache and lockedfile packages #218

merged 2 commits into from
May 15, 2023

Conversation

mvdan
Copy link
Collaborator

@mvdan mvdan commented Apr 29, 2023

(see commit messages - please do not squash)

Particularly the cache package, since I want to use it soon and it hadn't been updated since 2018.

@mvdan
Copy link
Collaborator Author

mvdan commented Apr 30, 2023

Should be passing CI now; I had to use a slightly older version of lockedfile to prevent a very recent refactor that broke 1.19 and 1.20.

mvdan added 2 commits May 8, 2023 11:33
As of commit 7a21f799a5ac23d3e191a106d71af9b8f65279fd,
which is crucially right before https://go.dev/cl/476917,
as then internal/filelock starts using Go 1.21's errors.ErrUnsupported.
We still want to support Go 1.19 and 1.20 for a while.

The only change besides the import path rewriting is to drop testenv,
which was only used for MustHaveExec and Command.

Note that we no longer need to worry about unix build tags,
as we now require Go 1.19 or later.
As of commit 0fd6ae548f550bdbee4a434285ff052fb9dc7417.

Besides rewriting import paths, we swapped base.Fatalf with log.Fatalf,
and replaced cfg.Getenv with os.Getenv, adding a note about the
difference in behavior. The old code already had this limitation.

We hadn't updated this package since it was first copied in 2018,
so quite a few changes have taken place.
Of note, it now supports mmap; leave that out for now, to keep this
commit simple and to leave adding the mmap package for another patch.

A minor API change is that Trim now returns an error.
While technically a breaking change, the vast majority of users will be
simply calling the API without expecting a result, and that will
continue to work like it did before.
Checking for errors on trim is useful, which is why upstream added it.

Finally, the cache now uses lockedfile, which we already copied over.
@mvdan mvdan merged commit 5821053 into rogpeppe:master May 15, 2023
6 checks passed
@mvdan mvdan deleted the updates branch May 18, 2023 20:00
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

Successfully merging this pull request may close these issues.

None yet

2 participants