1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/env bash # -*- Mode: Go -*- requests=$1 cat <<EOF | gofmt package nslcd_proto import "syscall" type Ucred syscall.Ucred type Backend interface { $(sed -rn 's/([^_]+)(.*)/\1\2(Ucred, Request_\1\2) <-chan \1/p' "$requests" | grep -v PAM) $(sed -rn 's/(PAM)(.*)/\1\2(Ucred, Request_\1\2) <-chan \1\2/p' "$requests") } EOF