refer to this plugin for a far nicer implementation https://github.com/lcmaguire/protoc-gen-svelte-rpc
for generating a go gRPC server based upon proto see protoc-gen-go-goo