mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
ci: enable checklocks workflow for specific packages
This turns the checklocks workflow into a real check, and adds annotations to a few basic packages as a starting point. Updates #12625 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I2b0185bae05a843b5257980fc6bde732b1bdd93f
This commit is contained in:
parent
8487fd2ec2
commit
0323dd01b2
10
.github/workflows/checklocks.yml
vendored
10
.github/workflows/checklocks.yml
vendored
@ -24,5 +24,11 @@ jobs:
|
|||||||
run: ./tool/go build -o /tmp/checklocks gvisor.dev/gvisor/tools/checklocks/cmd/checklocks
|
run: ./tool/go build -o /tmp/checklocks gvisor.dev/gvisor/tools/checklocks/cmd/checklocks
|
||||||
|
|
||||||
- name: Run checklocks vet
|
- name: Run checklocks vet
|
||||||
# TODO: remove || true once we have applied checklocks annotations everywhere.
|
# TODO(#12625): add more packages as we add annotations
|
||||||
run: ./tool/go vet -vettool=/tmp/checklocks ./... || true
|
run: |-
|
||||||
|
./tool/go vet -vettool=/tmp/checklocks \
|
||||||
|
./envknob \
|
||||||
|
./ipn/store/mem \
|
||||||
|
./net/stun/stuntest \
|
||||||
|
./net/wsconn \
|
||||||
|
./proxymap
|
||||||
|
@ -36,13 +36,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
set = map[string]string{}
|
// +checklocks:mu
|
||||||
regStr = map[string]*string{}
|
set = map[string]string{}
|
||||||
regBool = map[string]*bool{}
|
// +checklocks:mu
|
||||||
regOptBool = map[string]*opt.Bool{}
|
regStr = map[string]*string{}
|
||||||
|
// +checklocks:mu
|
||||||
|
regBool = map[string]*bool{}
|
||||||
|
// +checklocks:mu
|
||||||
|
regOptBool = map[string]*opt.Bool{}
|
||||||
|
// +checklocks:mu
|
||||||
regDuration = map[string]*time.Duration{}
|
regDuration = map[string]*time.Duration{}
|
||||||
regInt = map[string]*int{}
|
// +checklocks:mu
|
||||||
|
regInt = map[string]*int{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func noteEnv(k, v string) {
|
func noteEnv(k, v string) {
|
||||||
@ -51,6 +57,7 @@ func noteEnv(k, v string) {
|
|||||||
noteEnvLocked(k, v)
|
noteEnvLocked(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +checklocks:mu
|
||||||
func noteEnvLocked(k, v string) {
|
func noteEnvLocked(k, v string) {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
set[k] = v
|
set[k] = v
|
||||||
@ -202,6 +209,7 @@ func RegisterInt(envVar string) func() int {
|
|||||||
return func() int { return *p }
|
return func() int { return *p }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +checklocks:mu
|
||||||
func setBoolLocked(p *bool, envVar, val string) {
|
func setBoolLocked(p *bool, envVar, val string) {
|
||||||
noteEnvLocked(envVar, val)
|
noteEnvLocked(envVar, val)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
@ -215,6 +223,7 @@ func setBoolLocked(p *bool, envVar, val string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +checklocks:mu
|
||||||
func setOptBoolLocked(p *opt.Bool, envVar, val string) {
|
func setOptBoolLocked(p *opt.Bool, envVar, val string) {
|
||||||
noteEnvLocked(envVar, val)
|
noteEnvLocked(envVar, val)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
@ -228,6 +237,7 @@ func setOptBoolLocked(p *opt.Bool, envVar, val string) {
|
|||||||
p.Set(b)
|
p.Set(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +checklocks:mu
|
||||||
func setDurationLocked(p *time.Duration, envVar, val string) {
|
func setDurationLocked(p *time.Duration, envVar, val string) {
|
||||||
noteEnvLocked(envVar, val)
|
noteEnvLocked(envVar, val)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
@ -241,6 +251,7 @@ func setDurationLocked(p *time.Duration, envVar, val string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +checklocks:mu
|
||||||
func setIntLocked(p *int, envVar, val string) {
|
func setIntLocked(p *int, envVar, val string) {
|
||||||
noteEnvLocked(envVar, val)
|
noteEnvLocked(envVar, val)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
|
@ -20,7 +20,8 @@ func New(logger.Logf, string) (ipn.StateStore, error) {
|
|||||||
|
|
||||||
// Store is an ipn.StateStore that keeps state in memory only.
|
// Store is an ipn.StateStore that keeps state in memory only.
|
||||||
type Store struct {
|
type Store struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
// +checklocks:mu
|
||||||
cache map[ipn.StateKey][]byte
|
cache map[ipn.StateKey][]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type stunStats struct {
|
type stunStats struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
|
// +checklocks:mu
|
||||||
readIPv4 int
|
readIPv4 int
|
||||||
|
// +checklocks:mu
|
||||||
readIPv6 int
|
readIPv6 int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,11 @@ type netConn struct {
|
|||||||
afterReadDeadline atomic.Bool
|
afterReadDeadline atomic.Bool
|
||||||
|
|
||||||
readMu sync.Mutex
|
readMu sync.Mutex
|
||||||
eofed bool
|
// eofed is true if the reader should return io.EOF from the Read call.
|
||||||
|
//
|
||||||
|
// +checklocks:readMu
|
||||||
|
eofed bool
|
||||||
|
// +checklocks:readMu
|
||||||
reader io.Reader
|
reader io.Reader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,12 @@ import (
|
|||||||
// given localhost:port corresponds to.
|
// given localhost:port corresponds to.
|
||||||
type Mapper struct {
|
type Mapper struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
m map[string]map[netip.AddrPort]netip.Addr // proto ("tcp", "udp") => ephemeral => tailscale IP
|
|
||||||
|
// m holds the mapping from localhost IP:ports to Tailscale IPs. It is
|
||||||
|
// keyed first by the protocol ("tcp" or "udp"), then by the IP:port.
|
||||||
|
//
|
||||||
|
// +checklocks:mu
|
||||||
|
m map[string]map[netip.AddrPort]netip.Addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterIPPortIdentity registers a given node (identified by its
|
// RegisterIPPortIdentity registers a given node (identified by its
|
||||||
|
Loading…
x
Reference in New Issue
Block a user