Skip to content

Commit

Permalink
pkg: fix deprecated things
Browse files Browse the repository at this point in the history
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Feb 14, 2024
1 parent b67d943 commit f226dfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/crd/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ func builtinToType(basic *types.Basic, allowDangerousTypes bool) (typ string, fo
// Open coded go/types representation of encoding/json.Marshaller
var jsonMarshaler = types.NewInterfaceType([]*types.Func{
types.NewFunc(token.NoPos, nil, "MarshalJSON",
types.NewSignature(nil, nil,
types.NewSignatureType(nil, nil, nil,
types.NewTuple(
types.NewVar(token.NoPos, nil, "", types.NewSlice(types.Universe.Lookup("byte").Type())),
types.NewVar(token.NoPos, nil, "", types.Universe.Lookup("error").Type())), false)),
types.NewVar(token.NoPos, nil, "", types.Universe.Lookup("error").Type())), nil, false)),
}, nil).Complete()

func implementsJSONMarshaler(typ types.Type) bool {
Expand Down
8 changes: 4 additions & 4 deletions pkg/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func LoadRootsWithConfig(cfg *packages.Config, roots ...string) ([]*Package, err
cfg: cfg,
packages: make(map[*packages.Package]*Package),
}
l.cfg.Mode |= packages.LoadImports | packages.NeedTypesSizes
l.cfg.Mode |= packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedTypesSizes
if l.cfg.Fset == nil {
l.cfg.Fset = token.NewFileSet()
}
Expand All @@ -393,7 +393,7 @@ func LoadRootsWithConfig(cfg *packages.Config, roots ...string) ([]*Package, err
// and try and prevent packages from showing up twice when nested module
// support is enabled. there is not harm that comes from this per se, but
// it makes testing easier when a known number of modules can be asserted
uniquePkgIDs := sets.String{}
uniquePkgIDs := sets.Set[string]{}

// loadPackages returns the Go packages for the provided roots
//
Expand Down Expand Up @@ -604,9 +604,9 @@ func LoadRootsWithConfig(cfg *packages.Config, roots ...string) ([]*Package, err
// references with those from the rootPkgs list. This ensures the
// kubebuilder marker generation is handled correctly. For more info,
// please see issue 680.
func visitImports(rootPkgs []*Package, pkg *Package, seen sets.String) {
func visitImports(rootPkgs []*Package, pkg *Package, seen sets.Set[string]) {
if seen == nil {
seen = sets.String{}
seen = sets.Set[string]{}
}
for importedPkgID, importedPkg := range pkg.Imports() {
for i := range rootPkgs {
Expand Down

0 comments on commit f226dfa

Please sign in to comment.