aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/xgbgen/context.go')
-rw-r--r--nexgb/xgbgen/context.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go
index c40313f..697413e 100644
--- a/nexgb/xgbgen/context.go
+++ b/nexgb/xgbgen/context.go
@@ -5,6 +5,7 @@ import (
"encoding/xml"
"fmt"
"log"
+ "sort"
"time"
)
@@ -70,6 +71,8 @@ func (c *Context) Morph(xmlBytes []byte) {
if c.protocol.isExt() {
c.Putln("\"github.com/BurntSushi/xgb/xproto\"")
}
+
+ sort.Sort(Protocols(c.protocol.Imports))
for _, imp := range c.protocol.Imports {
// We always import xproto, so skip it if it's explicitly imported
if imp.Name == "xproto" {
@@ -142,6 +145,8 @@ func (c *Context) Morph(xmlBytes []byte) {
}
// Now write Go source code
+ sort.Sort(Types(c.protocol.Types))
+ sort.Sort(Requests(c.protocol.Requests))
for _, typ := range c.protocol.Types {
typ.Define(c)
}