bake: fix validation for linking to itself

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2024-09-16 16:29:27 -07:00
parent 056cf8a7ca
commit 9bfa8603f6
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39
1 changed files with 1 additions and 1 deletions

View File

@ -480,7 +480,7 @@ func (c Config) loadLinks(name string, t *Target, m map[string]*Target, o map[st
for _, v := range t.Contexts { for _, v := range t.Contexts {
if strings.HasPrefix(v, "target:") { if strings.HasPrefix(v, "target:") {
target := strings.TrimPrefix(v, "target:") target := strings.TrimPrefix(v, "target:")
if target == t.Name { if target == name {
return errors.Errorf("target %s cannot link to itself", target) return errors.Errorf("target %s cannot link to itself", target)
} }
for _, v := range visited { for _, v := range visited {