From 7cc151f7671319e15eb17804b60f3849fddeefc6 Mon Sep 17 00:00:00 2001 From: Florian Lehner Date: Sat, 27 Apr 2024 09:14:31 +0200 Subject: [PATCH] Add SetOption to example Signed-off-by: Florian Lehner --- example_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/example_test.go b/example_test.go index a866875..251f89c 100644 --- a/example_test.go +++ b/example_test.go @@ -31,6 +31,13 @@ func ExampleNfqueue_RegisterWithErrorFunc() { } defer nf.Close() + // Avoid receiving ENOBUFS errors. + if err := nf.SetOption(netlink.NoENOBUFS, true); err != nil { + fmt.Fprintf(os.Stderr, "failed to set netlink option %v: %v", + netlink.NoENOBUFS, err) + return + } + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel()