(spec *MutatorSpec)
| 100 | } |
| 101 | |
| 102 | func SaveMutatorSpec(spec *MutatorSpec) error { |
| 103 | if spec.MutatorId == "" { |
| 104 | return fmt.Errorf("cannot save mutator spec with empty mutatorid") |
| 105 | } |
| 106 | |
| 107 | if err := ValidateSpec(spec); err != nil { |
| 108 | return err |
| 109 | } |
| 110 | |
| 111 | saveModes := []fileloader.SaveOption{} |
| 112 | if configs.GetFilePathsConfig().CarefulSaveFiles { |
| 113 | saveModes = append(saveModes, fileloader.SaveCareful) |
| 114 | } |
| 115 | |
| 116 | if err := fileloader.SaveFlatFile[*MutatorSpec](configs.GetFilePathsConfig().DataFiles.String()+`/mutators`, spec, saveModes...); err != nil { |
| 117 | return err |
| 118 | } |
| 119 | |
| 120 | allMutators[spec.MutatorId] = spec |
| 121 | return nil |
| 122 | } |
| 123 | |
| 124 | func DeleteMutatorSpec(mutatorId string) error { |
| 125 | spec := GetMutatorSpec(mutatorId) |
no test coverage detected