Use switch for readability

Co-Authored-By: c0sco <778087+c0sco@users.noreply.github.com>
This commit is contained in:
Adrien Delorme 2018-10-30 10:06:31 -07:00 committed by GitHub
parent e980ecee63
commit b113518815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -92,7 +92,9 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
}
}
if !(p.config.Format == "ova" || p.config.Format == "raw" || p.config.Format == "vmdk" || p.config.Format == "vhd" || p.config.Format == "vhdx") {
switch p.config.Format {
case "ova", "raw", "vmdk", "vhd", "vhdx":
default:
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("invalid format '%s'. Only 'ova', 'raw', 'vhd', 'vhdx', or 'vmdk' are allowed", p.config.Format))
}