1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/env bash # -*- Mode: Go -*- interface=$1 cat <<EOF | gofmt package util import p "nslcd_proto" type NullBackend struct{} $(< "$interface" sed -rn 's/^\t([^(]+)\(Ucred, ([^)]+)\) <-chan (\S+)$/func (o NullBackend) \1(p.Ucred, p.\2) <-chan p.\3 { r := make(chan p.\3); close(r); return r }/p') var _ p.Backend = NullBackend{} EOF