mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-30 01:15:45 +08:00
Merge pull request #2778 from jsternberg/improve-missing-name-set-error
bake: improve error when using incorrect format for setting labels
This commit is contained in:
commit
850e5330ad
16
bake/bake.go
16
bake/bake.go
@ -725,10 +725,12 @@ type Target struct {
|
|||||||
linked bool
|
linked bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ hclparser.WithEvalContexts = &Target{}
|
var (
|
||||||
var _ hclparser.WithGetName = &Target{}
|
_ hclparser.WithEvalContexts = &Target{}
|
||||||
var _ hclparser.WithEvalContexts = &Group{}
|
_ hclparser.WithGetName = &Target{}
|
||||||
var _ hclparser.WithGetName = &Group{}
|
_ hclparser.WithEvalContexts = &Group{}
|
||||||
|
_ hclparser.WithGetName = &Group{}
|
||||||
|
)
|
||||||
|
|
||||||
func (t *Target) normalize() {
|
func (t *Target) normalize() {
|
||||||
t.Annotations = removeDupes(t.Annotations)
|
t.Annotations = removeDupes(t.Annotations)
|
||||||
@ -865,7 +867,7 @@ func (t *Target) AddOverrides(overrides map[string]Override) error {
|
|||||||
t.Dockerfile = &value
|
t.Dockerfile = &value
|
||||||
case "args":
|
case "args":
|
||||||
if len(keys) != 2 {
|
if len(keys) != 2 {
|
||||||
return errors.Errorf("args require name")
|
return errors.Errorf("invalid format for args, expecting args.<name>=<value>")
|
||||||
}
|
}
|
||||||
if t.Args == nil {
|
if t.Args == nil {
|
||||||
t.Args = map[string]*string{}
|
t.Args = map[string]*string{}
|
||||||
@ -873,7 +875,7 @@ func (t *Target) AddOverrides(overrides map[string]Override) error {
|
|||||||
t.Args[keys[1]] = &value
|
t.Args[keys[1]] = &value
|
||||||
case "contexts":
|
case "contexts":
|
||||||
if len(keys) != 2 {
|
if len(keys) != 2 {
|
||||||
return errors.Errorf("contexts require name")
|
return errors.Errorf("invalid format for contexts, expecting contexts.<name>=<value>")
|
||||||
}
|
}
|
||||||
if t.Contexts == nil {
|
if t.Contexts == nil {
|
||||||
t.Contexts = map[string]string{}
|
t.Contexts = map[string]string{}
|
||||||
@ -881,7 +883,7 @@ func (t *Target) AddOverrides(overrides map[string]Override) error {
|
|||||||
t.Contexts[keys[1]] = value
|
t.Contexts[keys[1]] = value
|
||||||
case "labels":
|
case "labels":
|
||||||
if len(keys) != 2 {
|
if len(keys) != 2 {
|
||||||
return errors.Errorf("labels require name")
|
return errors.Errorf("invalid format for labels, expecting labels.<name>=<value>")
|
||||||
}
|
}
|
||||||
if t.Labels == nil {
|
if t.Labels == nil {
|
||||||
t.Labels = map[string]*string{}
|
t.Labels = map[string]*string{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user