Skip to content

Commit

Permalink
fix: rename in kpm add
Browse files Browse the repository at this point in the history
Signed-off-by: Asish Kumar <[email protected]>
  • Loading branch information
officialasishkumar committed May 19, 2024
1 parent 5e4e2bd commit 5a3394c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,10 @@ func (c *KpmClient) AddDepWithOpts(kclPkg *pkg.KclPkg, opt *opt.AddOptions) (*pk
}

// 3. update the kcl.mod and kcl.mod.lock.
if opt.NewPkgName != "" {
d.ChangePkgName(opt.NewPkgName)
}
tempDeps := kclPkg.ModFile.Dependencies.Deps[d.Name]
tempDeps.Name = opt.NewPkgName
kclPkg.ModFile.Dependencies.Deps[d.Name] = tempDeps

err = kclPkg.UpdateModAndLockFile()
if err != nil {
return nil, err
Expand Down
4 changes: 0 additions & 4 deletions pkg/package/modfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,6 @@ func (dep *Dependency) GetDownloadPath() string {
return ""
}

func (dep *Dependency) ChangePkgName(NewPkgName string) {
dep.Name = NewPkgName
}

func GenSource(sourceType string, uri string, tagName string) (Source, error) {
source := Source{}
if sourceType == GIT {
Expand Down

0 comments on commit 5a3394c

Please sign in to comment.