/usr/share/gocode/src/blitiri.com.ar/go/systemd/example_test.go is in golang-blitiri-go-systemd-dev 0.0+git20170821.0.aec3508-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | package systemd_test
import (
"fmt"
"net"
"blitiri.com.ar/go/systemd"
)
func serve(l net.Listener) {
// Serve over the listener.
}
func Example() {
listeners, err := systemd.Listeners()
if err != nil {
fmt.Printf("error getting listeners: %v", err)
return
}
// Iterate over the listeners of a particular systemd socket.
// The name comes from the FileDescriptorName option, defaults to the name
// of the socket unit.
for _, l := range listeners["service.socket"] {
go serve(l)
}
}
|