Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelSpeed committed May 19, 2023
1 parent 2f400ff commit 4affe20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
10 changes: 0 additions & 10 deletions pkg/applyconfigurations/applyconfiguration_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"io"
"io/fs"
"os"
"sort"
"strings"

. "github.com/onsi/ginkgo"
Expand All @@ -44,15 +43,6 @@ func (m outputToMap) Open(_ *loader.Package, path string) (io.WriteCloser, error
return m[path], nil
}

func (m outputToMap) fileList() []string {
ret := make([]string, 0, len(m))
for path := range m {
ret = append(ret, path)
}
sort.Strings(ret)
return ret
}

type outputFile struct {
contents []byte
}
Expand Down
8 changes: 3 additions & 5 deletions pkg/applyconfigurations/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ const importPathSuffix = "applyconfiguration"
type Generator struct {
// HeaderFile specifies the header text (e.g. license) to prepend to generated files.
HeaderFile string `marker:",optional"`

outputPath string
}

func (Generator) CheckFilter() loader.NodeFilter {
Expand Down Expand Up @@ -166,15 +164,15 @@ func (u *Universe) existingApplyConfigPath(_ *types.Named, pkgPath string) (stri
return "", false
}

func (u *Universe) IsApplyConfigGenerated(typeInfo *types.Named, pkgPath string) bool {
func (u *Universe) IsApplyConfigGenerated(typeInfo *types.Named) bool {
if t, ok := u.typeMetadata[typeInfo]; ok {
return t.used
}
return false
}

func (u *Universe) GetApplyConfigPath(typeInfo *types.Named, pkgPath string) (string, bool) {
isApplyConfigGenerated := u.IsApplyConfigGenerated(typeInfo, pkgPath)
isApplyConfigGenerated := u.IsApplyConfigGenerated(typeInfo)
if path, ok := u.existingApplyConfigPath(typeInfo, pkgPath); ok {
if isApplyConfigGenerated {
return path, true
Expand Down Expand Up @@ -251,7 +249,7 @@ func (ctx *ObjectGenCtx) generateForPackage(root *loader.Package) error {

packages := applygenerator.Packages(c, genericArgs)
if err := c.ExecutePackages(genericArgs.OutputBase, packages); err != nil {
return err
return fmt.Errorf("error executing packages: %w", err)
}

return nil
Expand Down

0 comments on commit 4affe20

Please sign in to comment.