func goFileName(f *descriptor.FileDescriptorProto) string {
	name := *f.Name
	if ext := path.Ext(name); ext == ".proto" || ext == ".protodevel" {
		name = name[:len(name)-len(ext)]
	}
	name += ".twirp.ln.go"
	if impPath, _, ok := goPackageOption(f); ok && impPath != "" {
		_, name = path.Split(name)
		name = path.Join(impPath, name)
		return name
	}
	return name
}
goFileName returns the output name for the generated Go file.
package main
import (
	"path"
	"strings"
	"github.com/golang/protobuf/protoc-gen-go/descriptor"
	"github.com/twitchtv/protogen/stringutils"
)
func goPackageOption(f *descriptor.FileDescriptorProto) (impPath, pkg string, ok bool) {
	pkg = f.GetOptions().GetGoPackage()
	if pkg == "" {
		return
	}
	ok = true
	slash := strings.LastIndex(pkg, "/")
	if slash < 0 {
		return
	}
	impPath, pkg = pkg, pkg[slash+1:]
	sc := strings.IndexByte(impPath, ';')
	if sc < 0 {
		return
	}
	impPath, pkg = impPath[:sc], impPath[sc+1:]
	return
}
func goPackageName(f *descriptor.FileDescriptorProto) (name string, explicit bool) {
	if _, pkg, ok := goPackageOption(f); ok {
		return pkg, true
	}
	if pkg := f.GetPackage(); pkg != "" {
		return pkg, false
	}
	return stringutils.BaseName(f.GetName()), false
}