compiler/protogen: allow specifying the package name with M flags

When using the M flags (which is functionally a mapping of
filenames to Go package paths), provide the user the ability to also
specify the package name by delimiting the package path with a ";".

Example usage:
	Mpath/to/foo.proto=path/to/foo_go_proto;foopb

This uses the exact same syntax as the go_package option where a
";" delimiter can be used to specify a package name.
It brings the M flags and the go_package option closer in behavior.

Change-Id: I98e1fbb66ec2f1b70b4143b305355e5ab35ea198
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/223819
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/compiler/protogen/protogen_test.go b/compiler/protogen/protogen_test.go
index 1f7b75c..0967516 100644
--- a/compiler/protogen/protogen_test.go
+++ b/compiler/protogen/protogen_test.go
@@ -142,6 +142,15 @@
 			wantFilenamePrefix: "golang.org/x/foo/filename",
 		},
 		{
+			desc:               "command line sets import path for a file with package name specified",
+			parameter:          "Mdir/filename.proto=golang.org/x/bar;bar",
+			goPackageOption:    "golang.org/x/foo",
+			generate:           true,
+			wantPackageName:    "bar",
+			wantImportPath:     "golang.org/x/bar",
+			wantFilenamePrefix: "golang.org/x/foo/filename",
+		},
+		{
 			desc:               "import_path parameter sets import path of generated files",
 			parameter:          "import_path=golang.org/x/bar",
 			goPackageOption:    "golang.org/x/foo",