all: cleanup unused code, part 1 (#10661)
Run `staticcheck` with `U1000` to find unused code. This cleans up about a half of it. I'll do the other half separately to keep PRs manageable. Updates #cleanup Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
func TestAlignedAtomicInt64(t *testing.T) {
|
||||
type T struct {
|
||||
A atomicbitops.Int64
|
||||
x int32
|
||||
_ int32
|
||||
B atomicbitops.Int64
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package vms
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/netip"
|
||||
"runtime"
|
||||
"testing"
|
||||
@@ -43,9 +42,3 @@ func TestDeriveBindhost(t *testing.T) {
|
||||
}
|
||||
t.Log(deriveBindhost(t))
|
||||
}
|
||||
|
||||
type nopWriteCloser struct {
|
||||
io.Writer
|
||||
}
|
||||
|
||||
func (nwc nopWriteCloser) Close() error { return nil }
|
||||
|
||||
@@ -19,8 +19,6 @@ import (
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
const timeout = 15 * time.Second
|
||||
|
||||
func retry(t *testing.T, fn func() error) {
|
||||
t.Helper()
|
||||
const tries = 3
|
||||
|
||||
@@ -442,16 +442,6 @@ func (m *Machine) forwardPacket(p *Packet, iif *Interface) {
|
||||
oif.net.write(p)
|
||||
}
|
||||
|
||||
func unspecOf(ip netip.Addr) netip.Addr {
|
||||
if ip.Is4() {
|
||||
return v4unspec
|
||||
}
|
||||
if ip.Is6() {
|
||||
return v6unspec
|
||||
}
|
||||
panic(fmt.Sprintf("bogus IP %#v", ip))
|
||||
}
|
||||
|
||||
// Attach adds an interface to a machine.
|
||||
//
|
||||
// The first interface added to a Machine becomes that machine's
|
||||
@@ -572,19 +562,6 @@ func (m *Machine) interfaceForIP(ip netip.Addr) (*Interface, error) {
|
||||
return nil, fmt.Errorf("no route found to %v", ip)
|
||||
}
|
||||
|
||||
func (m *Machine) hasv6() bool {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
for _, f := range m.interfaces {
|
||||
for _, ip := range f.ips {
|
||||
if ip.Is6() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Machine) pickEphemPort() (port uint16, err error) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user