Repository navigation
Add cautions about unstable Go API and fix GPG key link - #4582
Merged
Merged
Conversation
Correct the URL link to the GPG key for one maintainer.
Since Git LFS is only intended to be utilized as a compiled binary and as we do not provide any guarantee of a stable API or ABI, add notes this effect in go.mod and our main README.
bk2204
approved these changes
Aug 16, 2021
chrisd8088
added a commit
that referenced
this pull request
Aug 5, 2026
In PR #1955 we resolved a problem in the Read() methods of the interfaces we use to invoke callback functions that write entries to the progress log file defined by the GIT_LFS_PROGRESS environment variable. (These methods are currently located in our "tools" package, but at the time they were defined in a package named "progress".) The BodyWithCallback and CallbackReader structure types in our "tools" package both implement the Reader interface from the "io" package of the Go standard library by passing through calls from their Read() methods to the Read() method of another implementation of the Reader interface. Depending on the return values from that call, our structures' Read() methods may then invoke a callback function to write an entry in the progress log file. In commit a2a7b09 of PR #1955 we fixed a bug in the Read() methods of our BodyWithCallback and CallbackReader structures whereby the methods would fail to invoke their callback functions if the underlying Read() method read a non-zero number of bytes but also encountered an EOF condition. The change from commit a2a7b09 now ensures the callback function is invoked under these circumstances, but it also replaces the EOF error with the error returned by the callback function, which will usually be nil. As a result, the callers of our structures' Read() methods then have to perform a second call to determine that the EOF condition has been reached. In this additional call, our structures' Read() methods will not invoke their callback functions because the underlying Read() method reads zero bytes; our methods will then return the EOF error from the underlying Read() method call. We will address this issue in a subsequent commit in this PR, and make several other revisions to the Read() methods of the BodyWithCallback and CallbackReader structures. To ensure these changes are effective, we will also expand the set of tests we perform, both in our "tools" package and in our "lfs" package. As such, we expect to make use of the EOFReader test helper structure type added in commit 591307d of PR #1955, but we first need to move the definition of the structure into a common location where it can be imported into both the "tools" and "lfs" packages. Our EOFReader structure was introduced to help verify that the changes implemented in commit a2a7b09 were effective. As such, the structure's Read() method always returns an EOF error as soon as possible, even if a non-zero number of bytes were also read. In the tests we expect to add in subsequent commits in this PR, we will also need a test helper structure whose Read() method consistently returns an EOF error as late as possible, meaning that it only returns the EOF error when no bytes have also been read. To distinguish these two test helpers, and to help clarify the purpose of the existing EOFReader structure, we now rename it to EagerEOFByteReader. We also introduce a NewEagerEOFByteReader() function which we can use to initialize a new structure, so all of our test functions will not have to explicitly populate the structure's fields. As well, because we will need to use this structure (plus a complementary DeferredEOFByteReader structure) in the test functions from multiple packages, we create a new, common "internal/testutil" package and move the definition of the EagerEOFByteReader and its sole test function into this package. Note that in future, we may begin to move some of our other, existing packages into the "internal" directory, as we do not intend for their APIs or ABIs to be used in third-party applications. In PR #4582 we added a note to our "go.mod" file to caution developers not to rely on our packages having stable APIs or ABIs, but a more comprehensive approach would be to move the majority of our packages into the "internal" directory. However, we defer this work for the present time as it far exceeds the scope of this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Although we utilize Go modules in our build system and therefore have a
go.modfile with a defined module path (github.com/git-lfs/git-lfs/v2), Git LFS is intended to be used only as a compiled binary and so we add comments and cautions to the effect that Go developers should not import our main Go module or expect it to provide a stable API or ABI (as discussed in #4575 (comment)).While we're at it, let's also correct the link to one GPG key on our
READMEpage as well.Resolves #4574.