scorecard/clients/git
Spencer Schrock d55dbd12e6
⚠️ Switch RepoClient file access to io.ReadCloser (#3912)
* change file access method to io.ReadCloser

callers don't always need the full file.
large files are slow and can cause crashes.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch tests to hardcoded readers

Previously they returned bytes or strings, which have corresponding NewReader types.
Since they don't need to be closed, io.NopCloser works well to give them a fake Close.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch tests which called os.ReadFile to os.Open

os.File fufills io.ReadCloser, so this is an easy change

Signed-off-by: Spencer Schrock <sschrock@google.com>

* break tarball tests into two steps: reader and read

The rest of the test was kept the same to minimize the change.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* ossfuzz doesn't implement GetFileReader

Signed-off-by: Spencer Schrock <sschrock@google.com>

* appease linter during refactor

Signed-off-by: Spencer Schrock <sschrock@google.com>

* switch git client to new method

add check which ensures git client fulfills the interface

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2024-03-04 17:37:50 -08:00
..
client_test.go 🌱 Bump github.com/golangci/golangci-lint from 1.55.2 to 1.56.1 in /tools (#3867) 2024-02-09 10:53:24 -08:00
client.go ⚠️ Switch RepoClient file access to io.ReadCloser (#3912) 2024-03-04 17:37:50 -08:00
e2e_test.go 🌱 Included additional method to git client (#3761) 2024-01-07 17:53:58 +00:00
gitrepo_suite_test.go Initial implementation of go-git client (#2720) 2023-03-15 21:28:09 +00:00