Skip to content

Commit

Permalink
ipv4, ipv6: remove or move unused err* vars
Browse files Browse the repository at this point in the history
errNoSuchInterface is only used in ipv4/sys_asmreq.go which is not built
e.g. on Linux, so move it there.

Change-Id: I18b2e2ec8f321db3df164dcc6a69b8c92e6ab68c
Reviewed-on: https://go-review.googlesource.com/c/net/+/220097
Run-TryBot: Tobias Klauser <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Matt Layher <[email protected]>
  • Loading branch information
tklauser committed Feb 19, 2020
1 parent 1617124 commit f229aea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
17 changes: 7 additions & 10 deletions ipv4/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ import (
)

var (
errInvalidConn = errors.New("invalid connection")
errMissingAddress = errors.New("missing address")
errMissingHeader = errors.New("missing header")
errNilHeader = errors.New("nil header")
errHeaderTooShort = errors.New("header too short")
errExtHeaderTooShort = errors.New("extension header too short")
errInvalidConnType = errors.New("invalid conn type")
errNoSuchInterface = errors.New("no such interface")
errNoSuchMulticastInterface = errors.New("no such multicast interface")
errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH)
errInvalidConn = errors.New("invalid connection")
errMissingAddress = errors.New("missing address")
errNilHeader = errors.New("nil header")
errHeaderTooShort = errors.New("header too short")
errExtHeaderTooShort = errors.New("extension header too short")
errInvalidConnType = errors.New("invalid conn type")
errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH)

// See https://www.freebsd.org/doc/en/books/porters-handbook/versions.html.
freebsdVersion uint32
Expand Down
3 changes: 3 additions & 0 deletions ipv4/sys_asmreq.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
package ipv4

import (
"errors"
"net"
"unsafe"

"golang.org/x/net/internal/socket"
)

var errNoSuchInterface = errors.New("no such interface")

func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
mreq := ipMreq{Multiaddr: [4]byte{grp[0], grp[1], grp[2], grp[3]}}
if err := setIPMreqInterface(&mreq, ifi); err != nil {
Expand Down
1 change: 0 additions & 1 deletion ipv6/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var (
errMissingAddress = errors.New("missing address")
errHeaderTooShort = errors.New("header too short")
errInvalidConnType = errors.New("invalid conn type")
errNoSuchInterface = errors.New("no such interface")
errNotImplemented = errors.New("not implemented on " + runtime.GOOS + "/" + runtime.GOARCH)
)

Expand Down

0 comments on commit f229aea

Please sign in to comment.