summaryrefslogtreecommitdiff
path: root/lib/btrfs/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/btrfs/Makefile')
-rw-r--r--lib/btrfs/Makefile9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/btrfs/Makefile b/lib/btrfs/Makefile
index 015c3e1..b98a1b7 100644
--- a/lib/btrfs/Makefile
+++ b/lib/btrfs/Makefile
@@ -80,13 +80,10 @@ btrfsprim/itemtype.go: btrfsitem/items.txt $(MAKEFILE_LIST)
sed -E 's,(.*)=([^:]*)(:.*)? (trivial|complex) (.*),\1_KEY ItemType=\2,' $< | uniq; \
echo ')'; \
echo 'func (t ItemType) String() string {'; \
- echo ' names := map[ItemType]string{'; \
- sed -E 's@(.*)=(.*) (trivial|complex) (.*)@\1_KEY: "\1",@' $< | sed 's/"UUID_/&KEY_/'; \
+ echo ' switch t {'; \
+ sed -E 's@(.*)=(.*) (trivial|complex) (.*)@case \1_KEY: return "\1"@' $< | sed 's/"UUID_/&KEY_/'; \
+ echo ' default: return fmt.Sprintf("%d", t)'; \
echo ' }'; \
- echo ' if name, ok := names[t]; ok {'; \
- echo ' return name'; \
- echo ' }'; \
- echo ' return fmt.Sprintf("%d", t)'; \
echo '}'; \
} | gofmt >$@
files += btrfsprim/itemtype.go