Debian Codegraph @

internal/maincmd/listeners_linux.go

raw symbols SCIP
1 //go:build linux
2
3 package maincmd
4
5 import (
6 "fmt"
7 "net"
8
9 "github.com/coreos/go-systemd/activation"
10 )
11
12 func systemdListeners() ([]net.Listener, error) {
13 listeners, err := activation.Listeners()
14 if err != nil {
15 return nil, err
16 }
17 if len(listeners) == 0 {
18 return nil, nil
19 }
20 if got, want := len(listeners), 1; got != want {
21 return nil, fmt.Errorf("unexpected number of sockets received from systemd: got %d, want %d", got, want)
22 }
23 return listeners, nil
24 }