Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80b6b64d authored by Jingwen Chen's avatar Jingwen Chen
Browse files

Add an error check in `bazelPackage` for malformed labels.

Bug: 204281595
Test: CI
Change-Id: Ia94a0b5c8dd3a0294475e9bc816a19ae03f7342d
parent 8528f4ec
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -370,11 +370,17 @@ func BazelModuleLabel(ctx TopDownMutatorContext, module blueprint.Module) string

func bazelShortLabel(label string) string {
	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:]
}

func bazelPackage(label string) string {
	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]
}