mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 11:05:45 +00:00
staticcheck.conf: turn off noisy lint errors
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
3728634af9
commit
297b3d6fa4
@ -74,7 +74,6 @@ func runCp(ctx context.Context, args []string) error {
|
||||
return runCpTargets(ctx, args)
|
||||
}
|
||||
if len(args) < 2 {
|
||||
//lint:ignore ST1005 no sorry need that colon at the end
|
||||
return errors.New("usage: tailscale file cp <files...> <target>:")
|
||||
}
|
||||
files, target := args[:len(args)-1], args[len(args)-1]
|
||||
|
@ -2711,7 +2711,6 @@ func (b *LocalBackend) CheckIPForwarding() error {
|
||||
return nil
|
||||
}
|
||||
if isBSD(runtime.GOOS) {
|
||||
//lint:ignore ST1005 output to users as is
|
||||
return fmt.Errorf("Subnet routing and exit nodes only work with additional manual configuration on %v, and is not currently officially supported.", runtime.GOOS)
|
||||
}
|
||||
|
||||
@ -2728,16 +2727,13 @@ func (b *LocalBackend) CheckIPForwarding() error {
|
||||
for _, key := range keys {
|
||||
bs, err := exec.Command("sysctl", "-n", key).Output()
|
||||
if err != nil {
|
||||
//lint:ignore ST1005 output to users as is
|
||||
return fmt.Errorf("couldn't check %s (%v).\nSubnet routes won't work without IP forwarding.", key, err)
|
||||
}
|
||||
on, err := strconv.ParseBool(string(bytes.TrimSpace(bs)))
|
||||
if err != nil {
|
||||
//lint:ignore ST1005 output to users as is
|
||||
return fmt.Errorf("couldn't parse %s (%v).\nSubnet routes won't work without IP forwarding.", key, err)
|
||||
}
|
||||
if !on {
|
||||
//lint:ignore ST1005 output to users as is
|
||||
return fmt.Errorf("%s is disabled. Subnet routes won't work.", key)
|
||||
}
|
||||
}
|
||||
|
@ -397,12 +397,10 @@ func (s *server) checkConnIdentityLocked(ci connIdentity) error {
|
||||
break
|
||||
}
|
||||
if ci.UserID != active.UserID {
|
||||
//lint:ignore ST1005 we want to capitalize Tailscale here
|
||||
return inUseOtherUserError{fmt.Errorf("Tailscale already in use by %s, pid %d", active.User.Username, active.Pid)}
|
||||
}
|
||||
}
|
||||
if su := s.serverModeUser; su != nil && ci.UserID != su.Uid {
|
||||
//lint:ignore ST1005 we want to capitalize Tailscale here
|
||||
return inUseOtherUserError{fmt.Errorf("Tailscale already in use by %s", su.Username)}
|
||||
}
|
||||
return nil
|
||||
|
@ -411,7 +411,7 @@ func (h *Handler) serveSetDNS(w http.ResponseWriter, r *http.Request) {
|
||||
func getDialPeerTransport(b *ipnlocal.LocalBackend) *http.Transport {
|
||||
dialPeerTransportOnce.Do(func() {
|
||||
t := http.DefaultTransport.(*http.Transport).Clone()
|
||||
t.Dial = nil //lint:ignore SA1019 yes I know I'm setting it to nil defensively
|
||||
t.Dial = nil
|
||||
dialer := net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
|
@ -15,7 +15,6 @@
|
||||
"sync"
|
||||
)
|
||||
|
||||
//lint:ignore U1000 work around false positive: https://github.com/dominikh/go-tools/issues/983
|
||||
var stderrFD = 2 // a variable for testing
|
||||
|
||||
type Options struct {
|
||||
|
@ -20,8 +20,6 @@
|
||||
// the lint exception is necessary and on others it is not,
|
||||
// and plain ignore complains if the exception is unnecessary.
|
||||
|
||||
//lint:file-ignore U1000 reconfigTimeout is used on some platforms but not others
|
||||
|
||||
// reconfigTimeout is the time interval within which Manager.{Up,Down} should complete.
|
||||
//
|
||||
// This is particularly useful because certain conditions can cause indefinite hangs
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
// +build linux
|
||||
|
||||
//lint:file-ignore U1000 refactoring, temporarily unused code.
|
||||
|
||||
package dns
|
||||
|
||||
import (
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
// +build linux
|
||||
|
||||
//lint:file-ignore U1000 refactoring, temporarily unused code.
|
||||
|
||||
package dns
|
||||
|
||||
import (
|
||||
|
@ -577,8 +577,6 @@ func pcpAnnounceRequest(myIP netaddr.IP) []byte {
|
||||
return pkt
|
||||
}
|
||||
|
||||
//lint:ignore U1000 moved this code from netcheck's old PCP probing; will be needed when we add PCP mapping
|
||||
|
||||
// pcpMapRequest generates a PCP packet with a MAP opcode.
|
||||
func pcpMapRequest(myIP netaddr.IP, mapToLocalPort int, delete bool) []byte {
|
||||
const udpProtoNumber = 17
|
||||
|
@ -23,7 +23,7 @@ func listPorts() (List, error) {
|
||||
}
|
||||
|
||||
func addProcesses(pl []Port) ([]Port, error) {
|
||||
//lint:ignore SA1019 OpenCurrentProcessToken instead of GetCurrentProcessToken,
|
||||
// OpenCurrentProcessToken instead of GetCurrentProcessToken,
|
||||
// as GetCurrentProcessToken only works on Windows 8+.
|
||||
tok, err := windows.OpenCurrentProcessToken()
|
||||
if err != nil {
|
||||
|
17
staticcheck.conf
Normal file
17
staticcheck.conf
Normal file
@ -0,0 +1,17 @@
|
||||
# Full list: https://staticcheck.io/docs/checks
|
||||
checks = [
|
||||
"SA*", "-SA1019", "-SA2001", # SA* are mostly legit code errors
|
||||
|
||||
# S1?? are "code simplifications" which we consider unnecessary
|
||||
|
||||
# ST1??? are stylistic issues, some of which are generally accepted
|
||||
# In general, if it's listed in
|
||||
# https://github.com/golang/go/wiki/CodeReviewComments, then it
|
||||
# may be an acceptable check.
|
||||
|
||||
# TODO(crawshaw): enable when we have docs? "ST1000", # missing package docs
|
||||
"ST1001", # discourage dot imports
|
||||
|
||||
"QF1004", # Use `strings.ReplaceAll` instead of `strings.Replace` with `n == 1`
|
||||
"QF1006", # Lift if+break into loop condition
|
||||
]
|
@ -4,8 +4,6 @@
|
||||
|
||||
// +build go1.13,!go1.16
|
||||
|
||||
//lint:file-ignore SA2001 the empty critical sections are part of triggering different internal mutex states
|
||||
|
||||
package syncs
|
||||
|
||||
import (
|
||||
|
@ -52,7 +52,7 @@ func Watch(ctx context.Context, mu sync.Locker, tick, max time.Duration) chan ti
|
||||
go func() {
|
||||
start := time.Now()
|
||||
mu.Lock()
|
||||
mu.Unlock() //lint:ignore SA2001 ignore the empty critical section
|
||||
mu.Unlock()
|
||||
elapsed := time.Since(start)
|
||||
if elapsed > max {
|
||||
elapsed = max
|
||||
|
@ -803,12 +803,10 @@ func TestDeriveBindhost(t *testing.T) {
|
||||
t.Log(deriveBindhost(t))
|
||||
}
|
||||
|
||||
//lint:ignore U1000 Xe: used when debugging the virtual machines
|
||||
type nopWriteCloser struct {
|
||||
io.Writer
|
||||
}
|
||||
|
||||
//lint:ignore U1000 Xe: used when debugging the virtual machines
|
||||
func (nwc nopWriteCloser) Close() error { return nil }
|
||||
|
||||
const metaDataTemplate = `instance-id: {{.ID}}
|
||||
|
@ -2,9 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//lint:file-ignore U1000 in development
|
||||
//lint:file-ignore S1000 in development
|
||||
|
||||
// Package natlab lets us simulate different types of networks all
|
||||
// in-memory without running VMs or requiring root, etc. Despite the
|
||||
// name, it does more than just NATs. But NATs are the most
|
||||
|
@ -85,8 +85,6 @@ func (k Private) Public() Public {
|
||||
func (k Private) SharedSecret(pub Public) (ss [32]byte) {
|
||||
apk := (*[32]byte)(&pub)
|
||||
ask := (*[32]byte)(&k)
|
||||
//lint:ignore SA1019 Code copied from wireguard-go, we aim for
|
||||
//minimal changes from it.
|
||||
curve25519.ScalarMult(&ss, ask, apk)
|
||||
return ss
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user