Skip to content

Commit

Permalink
feat: remove useless code
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <zongzhe1024@163.com>
  • Loading branch information
zong-zhe committed Nov 30, 2023
1 parent 9caa2db commit 16b1abe
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions pkg/api/kpm_pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ func (pkg *KclPackage) GetPkgProfile() pkg.Profile {
//
// And, the value is a map of schema types, the key is the schema name, the value is the schema type.
func (pkg *KclPackage) GetAllSchemaTypeMapping() (map[string]map[string]*KclType, error) {
return pkg.GetSchemaTypeMappingWithFilters([]KclTypeFilterFunc{IsSchemaType})
cli, err := client.NewKpmClient()
if err != nil {
return nil, err
}
return pkg.GetFullSchemaTypeMappingWithFilters(cli, []KclTypeFilterFunc{IsSchemaType})
}

// GetSchemaTypeMappingNamed returns the schema type filtered by schema name.
Expand All @@ -116,15 +120,6 @@ func (pkg *KclPackage) GetSchemaTypeMappingNamed(schemaName string) (map[string]
return pkg.GetSchemaTypeMappingWithFilters([]KclTypeFilterFunc{IsSchemaType, namedFilterFunc})
}

// GetAllFullSchemaTypeMapping returns all the full schema types of the package.
func (pkg *KclPackage) GetAllFullSchemaTypeMapping() (map[string]map[string]*KclType, error) {
cli, err := client.NewKpmClient()
if err != nil {
return nil, err
}
return pkg.GetFullSchemaTypeMappingWithFilters(cli, []KclTypeFilterFunc{IsSchemaType})
}

// GetFullSchemaTypeMappingWithFilters returns the full schema type filtered by the filter functions.
func (pkg *KclPackage) GetFullSchemaTypeMappingWithFilters(kpmcli *client.KpmClient, fileterFuncs []KclTypeFilterFunc) (map[string]map[string]*KclType, error) {
schemaTypes := make(map[string]map[string]*KclType)
Expand All @@ -142,7 +137,6 @@ func (pkg *KclPackage) GetFullSchemaTypeMappingWithFilters(kpmcli *client.KpmCli
}

opts := kcl.NewOption()
opts.Merge(kcl.WithKFilenames(path))
for depName, depPath := range depsMap {
opts.Merge(kcl.WithExternalPkgs(fmt.Sprintf(constants.EXTERNAL_PKGS_ARG_PATTERN, depName, depPath)))
}
Expand Down

0 comments on commit 16b1abe

Please sign in to comment.