MCPcopy Index your code
hub / github.com/jetify-com/devbox / SetPatch

Method SetPatch

internal/devconfig/configfile/packages.go:158–178  ·  view source on GitHub ↗
(versionedName string, mode PatchMode)

Source from the content-addressed store, hash-verified

156}
157
158func (pkgs *PackagesMutator) SetPatch(versionedName string, mode PatchMode) error {
159 if err := mode.validate(); err != nil {
160 return fmt.Errorf("set patch field for %s: %v", versionedName, err)
161 }
162
163 name, version := parseVersionedName(versionedName)
164 i := pkgs.index(name, version)
165 if i == -1 {
166 return errors.Errorf("package %s not found", versionedName)
167 }
168
169 pkgs.collection[i].PatchGlibc = false
170 pkgs.collection[i].Patch = mode
171 if mode == PatchAuto {
172 // PatchAuto is the default behavior, so just remove the field.
173 pkgs.ast.removePatch(name)
174 } else {
175 pkgs.ast.setPatch(name, mode)
176 }
177 return nil
178}
179
180func (pkgs *PackagesMutator) SetDisablePlugin(versionedName string, v bool) error {
181 name, version := parseVersionedName(versionedName)

Callers 1

setPackageOptionsMethod · 0.80

Calls 5

indexMethod · 0.95
parseVersionedNameFunction · 0.85
removePatchMethod · 0.80
setPatchMethod · 0.80
validateMethod · 0.45

Tested by

no test coverage detected