       (let [node (->> loc zip/node)]
         (recur (->> loc zip/next)
                (if (= node :message)
-                 (cons (buildmessage loc) msgs)
+                 (cons (buildmessage fqname loc) msgs)
                  msgs))))))
+
+(defn buildallmessages [ast]
+  (->> ast (map (fn [[fqname ast]] (buildmessages fqname ast))) flatten))
 
 ;;(defn generateproto [intf ast template]
 ;;  (loop [loc ast]

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

(defn compile [path config]

  (let [asts (compileall path config)
        messages (buildallmessages asts)
        protopath (io/file path "build/proto/project.proto")]

    ;; ensure the path exists
