1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/env bash # -*- Mode: Go -*- interface=$1 cat <<EOF | gofmt package nslcd_proto type NullBackend struct{} $(< "$interface" sed -rn 's/^\t(.*\) (\S+)_Enumerator)$/func (o NullBackend) \1 { return \2_Ø{} }/p') var _ Backend = NullBackend{} EOF