INNER CODE UNIT · Go
updateSpecVersion
cri-o/cri-o · scripts/version_bump.go:106
func updateSpecVersion(specFile, oldVersion, newVersion string) error {
content, err := os.ReadFile(specFile)
if err != nil {
return err
}
old := []byte("Version: " + oldVersion)
if !bytes.Contains(content, old) {
return fmt.Errorf("version %s not found in %s", oldVersion, specFile)
}
newContent := bytes.Replace(content, old, []byte("Version: "+newVersion), 1)
return os.WriteFile(specFile, newContent, 0o644)
}
func updateVersion(versionFile, newVersion string) error {
// Capture the "const"/"var" keyword and surrounding whitespace so the