1. Added golden file test.
2. Added support for mock.
3. Sanity fix.
diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl
index f3961f0..7dd2c04 100644
--- a/bazel/generate_cc.bzl
+++ b/bazel/generate_cc.bzl
@@ -23,7 +23,10 @@
   arguments = []
   if ctx.executable.plugin:
     arguments += ["--plugin=protoc-gen-PLUGIN=" + ctx.executable.plugin.path]
-    arguments += ["--PLUGIN_out=" + ",".join(ctx.attr.flags) + ":" + dir_out]
+    arguments += ["--PLUGIN_out=" + ",".join(ctx.attr.flags)]
+    if ctx.attr.generate_mock:
+      arguments += [",generate_mock_code=true"]
+    arguments += [":" + dir_out]
     additional_input = [ctx.executable.plugin]
   else:
     arguments += ["--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out]
@@ -71,6 +74,10 @@
         "well_known_protos" : attr.label(
             mandatory = False,
         ),
+        "generate_mock" : attr.bool(
+            default = False,
+            mandatory = False,
+        ),
         "_protoc": attr.label(
             default = Label("//external:protocol_compiler"),
             executable = True,