regroup duplicate error message
This commit is contained in:
parent
0102f5b6fa
commit
79d7b3e636
|
@ -48,23 +48,14 @@ func (p *Parser) decodeBuildConfig(block *hcl.Block) (*BuildBlock, hcl.Diagnosti
|
||||||
for _, buildFrom := range b.FromSources {
|
for _, buildFrom := range b.FromSources {
|
||||||
ref := sourceRefFromString(buildFrom)
|
ref := sourceRefFromString(buildFrom)
|
||||||
|
|
||||||
if ref == NoSource {
|
if ref == NoSource ||
|
||||||
diags = append(diags, &hcl.Diagnostic{
|
!hclsyntax.ValidIdentifier(ref.Type) ||
|
||||||
Severity: hcl.DiagError,
|
|
||||||
Summary: "Invalid " + sourceLabel + " reference: " + buildFrom,
|
|
||||||
Detail: "A " + sourceLabel + " type must start with a letter and " +
|
|
||||||
"may contain only letters, digits, underscores, and dashes." +
|
|
||||||
"A valid source reference looks like: `source.type.name`",
|
|
||||||
Subject: block.DefRange.Ptr(),
|
|
||||||
})
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if !hclsyntax.ValidIdentifier(ref.Type) ||
|
|
||||||
!hclsyntax.ValidIdentifier(ref.Name) {
|
!hclsyntax.ValidIdentifier(ref.Name) {
|
||||||
diags = append(diags, &hcl.Diagnostic{
|
diags = append(diags, &hcl.Diagnostic{
|
||||||
Severity: hcl.DiagError,
|
Severity: hcl.DiagError,
|
||||||
Summary: "Invalid " + sourceLabel + " reference",
|
Summary: "Invalid " + sourceLabel + " reference",
|
||||||
Detail: "A " + sourceLabel + " type must start with a letter and " +
|
Detail: "A " + sourceLabel + " type is made of three parts that are" +
|
||||||
|
"split by a dot `.`; each part must start with a letter and " +
|
||||||
"may contain only letters, digits, underscores, and dashes." +
|
"may contain only letters, digits, underscores, and dashes." +
|
||||||
"A valid source reference looks like: `source.type.name`",
|
"A valid source reference looks like: `source.type.name`",
|
||||||
Subject: block.DefRange.Ptr(),
|
Subject: block.DefRange.Ptr(),
|
||||||
|
|
Loading…
Reference in New Issue