Skip to content

Commit

Permalink
fix: fix if case
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe committed Nov 12, 2024
1 parent f336504 commit 6a19493
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pkg/package/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@ func LoadKclPkgWithOpts(options ...LoadOption) (*KclPkg, error) {
}

pkgPath := opts.Path
var loadSettings *settings.Settings
if opts.Settings == nil {
loadSettings = settings.GetSettings()
} else {
loadSettings = opts.Settings
opts.Settings = settings.GetSettings()
}

modFile := new(ModFile)
Expand Down Expand Up @@ -120,7 +117,7 @@ func LoadKclPkgWithOpts(options ...LoadOption) (*KclPkg, error) {
return nil, fmt.Errorf("could not load 'kcl.mod' in '%s'\n%w", pkgPath, err)
}
// 2. Fill the default oci registry, the default oci registry is in the settings.
err = fillDepsInfoWithSettings(&modFile.Dependencies, loadSettings)
err = fillDepsInfoWithSettings(&modFile.Dependencies, opts.Settings)
if err != nil {
return nil, fmt.Errorf("could not load 'kcl.mod' in '%s'\n%w", pkgPath, err)
}
Expand All @@ -142,8 +139,8 @@ func LoadKclPkgWithOpts(options ...LoadOption) (*KclPkg, error) {
Version: lockDep.Version,
},
Oci: &downloader.Oci{
Reg: loadSettings.DefaultOciRegistry(),
Repo: utils.JoinPath(loadSettings.DefaultOciRepo(), lockDep.Name),
Reg: opts.Settings.DefaultOciRegistry(),
Repo: utils.JoinPath(opts.Settings.DefaultOciRepo(), lockDep.Name),
Tag: lockDep.Version,
},
}
Expand Down

0 comments on commit 6a19493

Please sign in to comment.