Skip to content

Commit

Permalink
Remove no provides check per @kaniini
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Myers <elizabeth.myers@chainguard.dev>
  • Loading branch information
Elizafox committed Sep 20, 2023
1 parent 49688bf commit cf1ccd4
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions pkg/build/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@ type LinterContext struct {
chk *config.Checks
}

func (lctx LinterContext) getPackageOptions() (*config.PackageOption, error) {
if lctx.pkgname == lctx.cfg.Package.Name {
return &lctx.cfg.Package.Options, nil
}

for _, spkg := range lctx.cfg.Subpackages {
if lctx.pkgname == spkg.Name {
return &spkg.Options, nil
}
}

// Shouldn't get here
return nil, fmt.Errorf("Could not locate package or subpackage!")
}

type linterFunc func(lctx LinterContext, path string, d fs.DirEntry) error

type linter struct {
Expand All @@ -69,7 +54,7 @@ var linterMap = map[string]linter{
}

var postLinterMap = map[string]postLinter{
"empty": postLinter{emptyPostLinter, "Verify that this package is supposed to be empty, if so set the no-provides package option; otherwise, check the build"},
"empty": postLinter{emptyPostLinter, "Verify that this package is supposed to be empty; if it is, disable this linter; otherwise check the build"},
}

var isDevRegex = regexp.MustCompile("^dev/")
Expand Down Expand Up @@ -167,7 +152,7 @@ func worldWriteableLinter(_ LinterContext, path string, d fs.DirEntry) error {
return nil
}

func emptyPostLinter(lctx LinterContext, fsys fs.FS) error {
func emptyPostLinter(_ LinterContext, fsys fs.FS) error {
foundfile := false
walkCb := func(path string, _ fs.DirEntry, err error) error {
if err != nil {
Expand All @@ -193,16 +178,6 @@ func emptyPostLinter(lctx LinterContext, fsys fs.FS) error {
return nil
}

options, err := lctx.getPackageOptions()
if err != nil {
return err
}

if options.NoProvides {
// Nothing to do
return nil
}

return fmt.Errorf("Package is empty but no-provides is not set")
}

Expand Down

0 comments on commit cf1ccd4

Please sign in to comment.