various fixes

This commit is contained in:
Adrien Delorme 2020-11-02 17:43:21 +01:00
parent d919fc28ab
commit 971254928a
2 changed files with 4 additions and 5 deletions

View File

@ -69,8 +69,7 @@ func testParse(t *testing.T, tests []parseTest) {
if tt.parseWantDiagHasErrors != gotDiags.HasErrors() {
t.Fatalf("Parser.parse() unexpected diagnostics HasErrors. %s", gotDiags)
}
if diff := cmp.Diff(tt.parseWantCfg, gotCfg, cmpOpts...,
); diff != "" {
if diff := cmp.Diff(tt.parseWantCfg, gotCfg, cmpOpts...); diff != "" {
t.Fatalf("Parser.parse() wrong packer config. %s", diff)
}

View File

@ -446,11 +446,11 @@ func decodeVariableValidationBlock(varName string, block *hcl.Block) (*VariableV
// English, we'll require the given error message to conform
// to that. We might relax this in future if e.g. we start
// presenting these error messages in a different way, or if
// Terraform starts supporting producing error messages in
// Packer starts supporting producing error messages in
// other human languages, etc.
// For pragmatism we also allow sentences ending with
// exclamation points, but we don't mention it explicitly here
// because that's not really consistent with the Terraform UI
// because that's not really consistent with the Packer UI
// writing style.
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
@ -485,7 +485,7 @@ func looksLikeSentences(s string) bool {
// (This will only see the first rune in a multi-rune combining sequence,
// but the first rune is generally the letter if any are, and if not then
// we'll just ignore it because we're primarily expecting English messages
// right now anyway, for consistency with all of Terraform's other output.)
// right now anyway, for consistency with all of Packers's other output.)
if unicode.IsLetter(first) && !unicode.IsUpper(first) {
return false
}