Skip to content

Commit

Permalink
fix: rm useless code changes
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe committed Nov 7, 2024
1 parent fc4496d commit 7d2c733
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/client/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ func WithAddPkgNameAlias(nameAlias string) AddOption {
}
}

func WithAddModSpec(modSpec *downloader.ModSpec) AddOption {
return func(opts *AddOptions) error {
if modSpec == nil {
return fmt.Errorf("modSpec cannot be nil")
}
if opts.Source == nil {
opts.Source = &downloader.Source{
ModSpec: modSpec,
}
} else {
opts.Source.ModSpec = modSpec
}

return nil
}
}

func WithAddSource(source *downloader.Source) AddOption {
return func(opts *AddOptions) error {
if source == nil {
Expand Down

0 comments on commit 7d2c733

Please sign in to comment.