diff --git a/ipn/ipnlocal/local_test.go b/ipn/ipnlocal/local_test.go index af0ca0473..2f3769e93 100644 --- a/ipn/ipnlocal/local_test.go +++ b/ipn/ipnlocal/local_test.go @@ -92,14 +92,14 @@ func TestNetworkMapCompare(t *testing.T) { }, { "Node names identical", - &netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "A"}}}, - &netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "A"}}}, + &netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "A"}}}, + &netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "A"}}}, true, }, { "Node names differ", - &netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "A"}}}, - &netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{Name: "B"}}}, + &netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "A"}}}, + &netmap.NetworkMap{Peers: []*tailcfg.Node{{Name: "B"}}}, false, }, { @@ -117,8 +117,8 @@ func TestNetworkMapCompare(t *testing.T) { { "Node Users differ", // User field is not checked. - &netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{User: 0}}}, - &netmap.NetworkMap{Peers: []*tailcfg.Node{&tailcfg.Node{User: 1}}}, + &netmap.NetworkMap{Peers: []*tailcfg.Node{{User: 0}}}, + &netmap.NetworkMap{Peers: []*tailcfg.Node{{User: 1}}}, true, }, } diff --git a/net/dns/ini_test.go b/net/dns/ini_test.go index e14ffdad0..c47c234bb 100644 --- a/net/dns/ini_test.go +++ b/net/dns/ini_test.go @@ -26,8 +26,8 @@ func TestParseIni(t *testing.T) { [network] # trailing comment generateResolvConf = false # trailing comment`, want: map[string]map[string]string{ - "automount": map[string]string{"enabled": "true", "root": "/mnt/"}, - "network": map[string]string{"generateResolvConf": "false"}, + "automount": {"enabled": "true", "root": "/mnt/"}, + "network": {"generateResolvConf": "false"}, }, }, } diff --git a/net/dns/resolver/tsdns_test.go b/net/dns/resolver/tsdns_test.go index 1d648dd15..ec5fb37af 100644 --- a/net/dns/resolver/tsdns_test.go +++ b/net/dns/resolver/tsdns_test.go @@ -41,8 +41,8 @@ var ( var dnsCfg = Config{ Hosts: map[dnsname.FQDN][]netaddr.IP{ - "test1.ipn.dev.": []netaddr.IP{testipv4}, - "test2.ipn.dev.": []netaddr.IP{testipv6}, + "test1.ipn.dev.": {testipv4}, + "test2.ipn.dev.": {testipv6}, }, LocalDomains: []dnsname.FQDN{"ipn.dev.", "3.2.1.in-addr.arpa.", "1.0.0.0.ip6.arpa."}, } diff --git a/paths/paths_windows.go b/paths/paths_windows.go index f1b34b633..19f0b9298 100644 --- a/paths/paths_windows.go +++ b/paths/paths_windows.go @@ -119,13 +119,13 @@ func ensureStateDirPerms(dirPath string) error { // We configure the DACL such that any files or directories created within // dirPath will also inherit this DACL. explicitAccess := []windows.EXPLICIT_ACCESS{ - windows.EXPLICIT_ACCESS{ + { windows.GENERIC_ALL, windows.SET_ACCESS, windows.SUB_CONTAINERS_AND_OBJECTS_INHERIT, userTrustee, }, - windows.EXPLICIT_ACCESS{ + { windows.GENERIC_ALL, windows.SET_ACCESS, windows.SUB_CONTAINERS_AND_OBJECTS_INHERIT, diff --git a/portlist/netstat_test.go b/portlist/netstat_test.go index e7824d3ab..c6b18f0a8 100644 --- a/portlist/netstat_test.go +++ b/portlist/netstat_test.go @@ -15,13 +15,13 @@ func TestParsePort(t *testing.T) { expect int } tests := []InOut{ - InOut{"1.2.3.4:5678", 5678}, - InOut{"0.0.0.0.999", 999}, - InOut{"1.2.3.4:*", 0}, - InOut{"5.5.5.5:0", 0}, - InOut{"[1::2]:5", 5}, - InOut{"[1::2].5", 5}, - InOut{"gibberish", -1}, + {"1.2.3.4:5678", 5678}, + {"0.0.0.0.999", 999}, + {"1.2.3.4:*", 0}, + {"5.5.5.5:0", 0}, + {"[1::2]:5", 5}, + {"[1::2].5", 5}, + {"gibberish", -1}, } for _, io := range tests { diff --git a/tstest/staticcheck/staticcheck.go b/tstest/staticcheck/staticcheck.go index 2cef382d7..a7d0e2d57 100644 --- a/tstest/staticcheck/staticcheck.go +++ b/tstest/staticcheck/staticcheck.go @@ -5,6 +5,7 @@ // This file exists just so go mod tidy won't remove // staticcheck's module from our go.mod. +//go:build tools // +build tools package tstest diff --git a/util/deephash/deephash_test.go b/util/deephash/deephash_test.go index 3309ccfc3..c42851fc9 100644 --- a/util/deephash/deephash_test.go +++ b/util/deephash/deephash_test.go @@ -173,7 +173,7 @@ func getVal() []interface{} { &tailcfg.MapResponse{ DERPMap: &tailcfg.DERPMap{ Regions: map[int]*tailcfg.DERPRegion{ - 1: &tailcfg.DERPRegion{ + 1: { RegionID: 1, RegionCode: "foo", Nodes: []*tailcfg.DERPNode{ diff --git a/wf/firewall.go b/wf/firewall.go index e3282d2f2..cc66290e5 100644 --- a/wf/firewall.go +++ b/wf/firewall.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows package wf diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go index 80cb47c61..5ae18de52 100644 --- a/wgengine/magicsock/magicsock_test.go +++ b/wgengine/magicsock/magicsock_test.go @@ -401,14 +401,14 @@ func TestPickDERPFallback(t *testing.T) { c := newConn() dm := &tailcfg.DERPMap{ Regions: map[int]*tailcfg.DERPRegion{ - 1: &tailcfg.DERPRegion{}, - 2: &tailcfg.DERPRegion{}, - 3: &tailcfg.DERPRegion{}, - 4: &tailcfg.DERPRegion{}, - 5: &tailcfg.DERPRegion{}, - 6: &tailcfg.DERPRegion{}, - 7: &tailcfg.DERPRegion{}, - 8: &tailcfg.DERPRegion{}, + 1: {}, + 2: {}, + 3: {}, + 4: {}, + 5: {}, + 6: {}, + 7: {}, + 8: {}, }, } c.derpMap = dm @@ -1011,7 +1011,7 @@ func testTwoDevicePing(t *testing.T, d *devices) { PrivateKey: m1.privateKey, Addresses: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.1/32")}, Peers: []wgcfg.Peer{ - wgcfg.Peer{ + { PublicKey: m2.privateKey.Public(), DiscoKey: m2.conn.DiscoPublicKey(), AllowedIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.2/32")}, @@ -1023,7 +1023,7 @@ func testTwoDevicePing(t *testing.T, d *devices) { PrivateKey: m2.privateKey, Addresses: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.2/32")}, Peers: []wgcfg.Peer{ - wgcfg.Peer{ + { PublicKey: m1.privateKey.Public(), DiscoKey: m1.conn.DiscoPublicKey(), AllowedIPs: []netaddr.IPPrefix{netaddr.MustParseIPPrefix("1.0.0.1/32")}, diff --git a/wgengine/userspace_test.go b/wgengine/userspace_test.go index e1550f454..825645d0e 100644 --- a/wgengine/userspace_test.go +++ b/wgengine/userspace_test.go @@ -99,7 +99,7 @@ func TestUserspaceEngineReconfig(t *testing.T) { } { nm := &netmap.NetworkMap{ Peers: []*tailcfg.Node{ - &tailcfg.Node{ + { Key: nkFromHex(nodeHex), }, }, diff --git a/wgengine/winnet/winnet.go b/wgengine/winnet/winnet.go index 086b07638..582566367 100644 --- a/wgengine/winnet/winnet.go +++ b/wgengine/winnet/winnet.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build windows // +build windows package winnet