NewChecker takes CheckerOptions instead of positional arguments (closes #78)
check / check (push) Waiting to run
check / check (push) Waiting to run
NewChecker now takes *CheckerOptions (ManifestPath, BasePath, Fs), named like ScannerOptions. A nil Fs still means the OS filesystem, as before and as in ScannerOptions; nil options or an empty path return an error naming the missing path. Audit of the other exported constructors in mfer: NewManifestFromFile took a filesystem and a path positionally; it now takes *ManifestFromFileOptions (Path, Fs) with the same nil and empty rules. NewBuilder and NewScanner take no arguments, NewScannerWithOptions already takes options, and NewManifestFromReader takes one reader, which the style guide exempts; these are unchanged. Model: opus-5-5
This commit was merged in pull request #137.
This commit is contained in:
@@ -61,7 +61,11 @@ func unsignedChecker(t *testing.T) *mfer.Checker {
|
||||
require.NoError(t, s.ToManifest(context.Background(), &buf, nil))
|
||||
require.NoError(t, afero.WriteFile(fs, "/d/index.mf", buf.Bytes(), 0o644))
|
||||
|
||||
chk, err := mfer.NewChecker("/d/index.mf", "/d", fs)
|
||||
chk, err := mfer.NewChecker(&mfer.CheckerOptions{
|
||||
ManifestPath: "/d/index.mf",
|
||||
BasePath: "/d",
|
||||
Fs: fs,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.False(t, chk.IsSigned())
|
||||
|
||||
@@ -167,7 +171,11 @@ func signedChecker(t *testing.T) *mfer.Checker {
|
||||
fs := afero.NewMemMapFs()
|
||||
require.NoError(t, afero.WriteFile(fs, "/index.mf", buf.Bytes(), 0o644))
|
||||
|
||||
chk, err := mfer.NewChecker("/index.mf", "/", fs)
|
||||
chk, err := mfer.NewChecker(&mfer.CheckerOptions{
|
||||
ManifestPath: "/index.mf",
|
||||
BasePath: "/",
|
||||
Fs: fs,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.True(t, chk.IsSigned())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user