protogen: support passing command-line parameters to plugins

Add a protogen.Options struct for future expansion. Include a FlagSet
which will be populated with parameters passed to the plugin.

Change-Id: I26a13bbde7ce011135b9c151edd160f3b51b7f9a
Reviewed-on: https://go-review.googlesource.com/134696
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/cmd/protoc-gen-go/main.go b/cmd/protoc-gen-go/main.go
index d91e7a1..c243e00 100644
--- a/cmd/protoc-gen-go/main.go
+++ b/cmd/protoc-gen-go/main.go
@@ -11,6 +11,7 @@
 	"compress/gzip"
 	"crypto/sha256"
 	"encoding/hex"
+	"flag"
 	"fmt"
 	"strconv"
 	"strings"
@@ -24,7 +25,13 @@
 const protoPackage = "github.com/golang/protobuf/proto"
 
 func main() {
-	protogen.Run(func(gen *protogen.Plugin) error {
+	var flags flag.FlagSet
+	// TODO: Decide what to do for backwards compatibility with plugins=grpc.
+	flags.String("plugins", "", "")
+	opts := &protogen.Options{
+		ParamFunc: flags.Set,
+	}
+	protogen.Run(opts, func(gen *protogen.Plugin) error {
 		for _, f := range gen.Files {
 			if !f.Generate {
 				continue