     (map (fn [[index {:keys [modifier type fieldName]}]]
            (->Field modifier (let [[_ _type] type] _type) fieldName index)) rawfields)))
 
-(defn buildmessage [ast]
+(defn buildmessage [fqname ast]
   (let [name (->> ast zip/right zip/node)
         fields (buildfields (->> ast zip/right zip/right))]
-    (->Message name fields)))
+    (->Message (str fqname "." name) fields)))
 
-(defn buildmessages [ast]
+(defn buildmessages [fqname ast]
   (loop [loc ast msgs '()]
     (cond
 

      (let [node (->> loc zip/node)]
        (recur (->> loc zip/next)
               (if (= node :message)
                 (cons (buildmessage loc) msgs)
                 msgs))))))

;;(defn generateproto [intf ast template]
;;  (loop [loc ast]

    ;; and then generate our output
    (let [stg  (STGroupFile. "generators/proto.stg")
          template (.getInstanceOf stg "protobuf")]
      (.add template "messages" messages)
      (with-open [output (io/writer protopath :truncate true)]
        (.write output (.render template))))))
