Skip to content

Commit 0773afc

Browse files
committed
change netdb API to return ok bool instead of errors
1 parent 985dae3 commit 0773afc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

netstat-nat.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ func main() {
7171

7272
filteredFlows := flows.FilterByType(which)
7373
if *protocol != "" {
74-
protoent, err := netdb.GetProtoByName(*protocol)
75-
if err != nil {
74+
protoent, ok := netdb.GetProtoByName(*protocol)
75+
if !ok {
7676
// TODO descriptive error message
77-
panic(err)
77+
panic("Unknown protocol")
7878
}
7979
filteredFlows = filteredFlows.FilterByProtocol(protoent)
8080
}

0 commit comments

Comments
 (0)