Check if "instrumentation" and "sampling" are set together
Setting these simultaneously is an error.
Test: Check error generation in a test module
Change-Id: I2ee127fa1b7157fa5f4489d2541ff023c64f9ba5
diff --git a/cc/pgo.go b/cc/pgo.go
index 5d1c58a..a99cbad 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -124,13 +124,14 @@
}
// Sampling not supported yet
- //
- // TODO When sampling support is turned on, check that instrumentation and
- // sampling are not simultaneously specified
if isSampling {
ctx.PropertyErrorf("pgo.sampling", "\"sampling\" is not supported yet)")
}
+ if isSampling && isInstrumentation {
+ ctx.PropertyErrorf("pgo", "Exactly one of \"instrumentation\" and \"sampling\" properties must be set")
+ }
+
return true
}