Add an error check in bazelPackage
for malformed labels.
Bug: 204281595 Test: CI Change-Id: Ia94a0b5c8dd3a0294475e9bc816a19ae03f7342d
This commit is contained in:
@@ -370,11 +370,17 @@ func BazelModuleLabel(ctx TopDownMutatorContext, module blueprint.Module) string
|
|||||||
|
|
||||||
func bazelShortLabel(label string) string {
|
func bazelShortLabel(label string) string {
|
||||||
i := strings.Index(label, ":")
|
i := strings.Index(label, ":")
|
||||||
|
if i == -1 {
|
||||||
|
panic(fmt.Errorf("Could not find the ':' character in '%s', expected a fully qualified label.", label))
|
||||||
|
}
|
||||||
return label[i:]
|
return label[i:]
|
||||||
}
|
}
|
||||||
|
|
||||||
func bazelPackage(label string) string {
|
func bazelPackage(label string) string {
|
||||||
i := strings.Index(label, ":")
|
i := strings.Index(label, ":")
|
||||||
|
if i == -1 {
|
||||||
|
panic(fmt.Errorf("Could not find the ':' character in '%s', expected a fully qualified label.", label))
|
||||||
|
}
|
||||||
return label[0:i]
|
return label[0:i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user