mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-19 14:31:40 -04:00
Since the enumer implementation we used hadn't been updated for 5+ years, this didn't work with recent linux/go versions, and enumer crashed while attempting to parse/analyse the source files. There's another alternative on Github, forked from the one we used, which seems more maintained now, and does produce the expected files in Packer.
83 lines
2.2 KiB
Go
83 lines
2.2 KiB
Go
// Code generated by "enumer -type FixConfigMode"; DO NOT EDIT.
|
|
|
|
package packer
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const _FixConfigModeName = "StdoutInplaceDiff"
|
|
|
|
var _FixConfigModeIndex = [...]uint8{0, 6, 13, 17}
|
|
|
|
const _FixConfigModeLowerName = "stdoutinplacediff"
|
|
|
|
func (i FixConfigMode) String() string {
|
|
if i < 0 || i >= FixConfigMode(len(_FixConfigModeIndex)-1) {
|
|
return fmt.Sprintf("FixConfigMode(%d)", i)
|
|
}
|
|
return _FixConfigModeName[_FixConfigModeIndex[i]:_FixConfigModeIndex[i+1]]
|
|
}
|
|
|
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
// Re-run the stringer command to generate them again.
|
|
func _FixConfigModeNoOp() {
|
|
var x [1]struct{}
|
|
_ = x[Stdout-(0)]
|
|
_ = x[Inplace-(1)]
|
|
_ = x[Diff-(2)]
|
|
}
|
|
|
|
var _FixConfigModeValues = []FixConfigMode{Stdout, Inplace, Diff}
|
|
|
|
var _FixConfigModeNameToValueMap = map[string]FixConfigMode{
|
|
_FixConfigModeName[0:6]: Stdout,
|
|
_FixConfigModeLowerName[0:6]: Stdout,
|
|
_FixConfigModeName[6:13]: Inplace,
|
|
_FixConfigModeLowerName[6:13]: Inplace,
|
|
_FixConfigModeName[13:17]: Diff,
|
|
_FixConfigModeLowerName[13:17]: Diff,
|
|
}
|
|
|
|
var _FixConfigModeNames = []string{
|
|
_FixConfigModeName[0:6],
|
|
_FixConfigModeName[6:13],
|
|
_FixConfigModeName[13:17],
|
|
}
|
|
|
|
// FixConfigModeString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func FixConfigModeString(s string) (FixConfigMode, error) {
|
|
if val, ok := _FixConfigModeNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
|
|
if val, ok := _FixConfigModeNameToValueMap[strings.ToLower(s)]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to FixConfigMode values", s)
|
|
}
|
|
|
|
// FixConfigModeValues returns all values of the enum
|
|
func FixConfigModeValues() []FixConfigMode {
|
|
return _FixConfigModeValues
|
|
}
|
|
|
|
// FixConfigModeStrings returns a slice of all String values of the enum
|
|
func FixConfigModeStrings() []string {
|
|
strs := make([]string, len(_FixConfigModeNames))
|
|
copy(strs, _FixConfigModeNames)
|
|
return strs
|
|
}
|
|
|
|
// IsAFixConfigMode returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i FixConfigMode) IsAFixConfigMode() bool {
|
|
for _, v := range _FixConfigModeValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|