From 06fd2268d9f5017b42e2950a1f39fa9ba8784a77 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sat, 6 Dec 2014 14:23:10 +0100 Subject: [PATCH] Use Go 1.4 'generate' to create XDR codec --- build.go | 4 +--- internal/discover/packets.go | 3 +++ internal/files/leveldb.go | 3 +++ internal/protocol/message.go | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.go b/build.go index 5b75f318e..8b67cfcef 100644 --- a/build.go +++ b/build.go @@ -284,9 +284,7 @@ func assets() { } func xdr() { - for _, f := range []string{"internal/discover/packets", "internal/files/leveldb", "internal/protocol/message"} { - runPipe(f+"_xdr.go", "go", "run", "./Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go", "--", f+".go") - } + runPrint("go", "generate", "./internal/discover", "./internal/files", "./internal/protocol") } func translate() { diff --git a/internal/discover/packets.go b/internal/discover/packets.go index 85cf13b66..c0e53d427 100644 --- a/internal/discover/packets.go +++ b/internal/discover/packets.go @@ -13,6 +13,9 @@ // You should have received a copy of the GNU General Public License along // with this program. If not, see . +//go:generate -command genxdr go run ../../Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go +//go:generate genxdr -o packets_xdr.go packets.go + package discover const ( diff --git a/internal/files/leveldb.go b/internal/files/leveldb.go index 1fba0598b..9c93658fe 100644 --- a/internal/files/leveldb.go +++ b/internal/files/leveldb.go @@ -13,6 +13,9 @@ // You should have received a copy of the GNU General Public License along // with this program. If not, see . +//go:generate -command genxdr go run ../../Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go +//go:generate genxdr -o leveldb_xdr.go leveldb.go + package files import ( diff --git a/internal/protocol/message.go b/internal/protocol/message.go index 9a96f80c5..8cc191d8c 100644 --- a/internal/protocol/message.go +++ b/internal/protocol/message.go @@ -13,6 +13,9 @@ // You should have received a copy of the GNU General Public License along // with this program. If not, see . +//go:generate -command genxdr go run ../../Godeps/_workspace/src/github.com/calmh/xdr/cmd/genxdr/main.go +//go:generate genxdr -o message_xdr.go message.go + package protocol import "fmt"