title: Golang proto file management and importing
body: <p>I have 2 grpc services (<code>service1</code> and <code>service2</code>) that interact with each other and on some cases the rpc response of <code>service1</code> will consists of a struct defined in <code>service2</code>, after going to several situations where duplication is inevitable, i figure that as the services grow these will be hard to manage, so i restructure the proto files into something like this for now</p>
  
  <pre><code>.
  ├── app
  ...
  ├── proto
  │   ├── service1
  │   │   ├── service1.access.proto 
  │   │   ├── service1.proto
  │   ├── service2
  │   │   ├── service2.access.proto
  │   │   └── service2.proto
  │   └── model
  │       ├── model.service1.proto
  │       └── model.service2.proto
  └── proto-gen // the protoc generated files 
      ├── service1
      │   ├── service1.access.pb.go
      │   └── service1.pb.go
      ├── service2
      │   ├── service2.access.pb.go
      │   └── service2.pb.go
      └── model
          ├── model.service1.pb.go
          └── model.service2.pb.go
  </code></pre>
  
  <p><code>service1</code> needs to import the model definition on <code>model/model.service2.proto</code>, so i am importing it like this</p>
  
  <pre><code>import "model/model.service2.proto";
  
  option go_package = "proto-gen/service1"; 
  </code></pre>
  
  <p>and i generate the <code>.pb.go</code> files, using this <code>protoc</code> command</p>
  
  <pre><code>ls proto | awk '{print "protoc --proto_path=proto proto/"$1"/*.proto --go_out=plugins=grpc:."}' | sh
  </code></pre>
  
  <p>the command generates the <code>.pb.go</code> files just fine, but the code on <code>service1.access.pb.go</code> doesn't seem to import the model correctly, and i don't know if it related or not but when i run the app, it throws this error</p>
  
  <pre><code>cannot load model: malformed module path "model": missing dot in first path element
  </code></pre>
  
  <p>i spent a few hours now googling on how can i properly import another proto file, i can't seem to find any solution</p>