From ddce692f72af19606b4a714fb6981457368a5727 Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Tue, 9 May 2023 08:54:02 +0200 Subject: [PATCH] all: Correct various typos (#8870) --- cmd/stgenfiles/main.go | 6 +++--- gui/default/syncthing/core/modalDirective.js | 2 +- lib/connections/connections_test.go | 6 +++--- lib/connections/service.go | 12 ++++++------ lib/fs/filesystem_test.go | 2 +- lib/protocol/hello.go | 2 +- lib/util/semaphore_test.go | 10 +++++----- ...{parallell_scan_test.go => parallel_scan_test.go} | 0 test/util.go | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) rename test/{parallell_scan_test.go => parallel_scan_test.go} (100%) diff --git a/cmd/stgenfiles/main.go b/cmd/stgenfiles/main.go index c5d522f77..e7b572257 100644 --- a/cmd/stgenfiles/main.go +++ b/cmd/stgenfiles/main.go @@ -66,7 +66,7 @@ func generateFiles(dir string, files, maxexp int, srcname string) error { } func generateOneFile(fd io.ReadSeeker, p1 string, s int64) error { - src := io.LimitReader(&inifiteReader{fd}, s) + src := io.LimitReader(&infiniteReader{fd}, s) dst, err := os.Create(p1) if err != nil { return err @@ -105,11 +105,11 @@ func readRand(bs []byte) (int, error) { return len(bs), nil } -type inifiteReader struct { +type infiniteReader struct { rd io.ReadSeeker } -func (i *inifiteReader) Read(bs []byte) (int, error) { +func (i *infiniteReader) Read(bs []byte) (int, error) { n, err := i.rd.Read(bs) if err == io.EOF { err = nil diff --git a/gui/default/syncthing/core/modalDirective.js b/gui/default/syncthing/core/modalDirective.js index 43553ac0d..cc8ee4a95 100644 --- a/gui/default/syncthing/core/modalDirective.js +++ b/gui/default/syncthing/core/modalDirective.js @@ -70,7 +70,7 @@ angular.module('syncthing.core') }); - // inform syncthingContoller that a modal is ready + // inform syncthingController that a modal is ready scope.$parent.modalLoaded(); } }; diff --git a/lib/connections/connections_test.go b/lib/connections/connections_test.go index ad30f82d0..0061d16f9 100644 --- a/lib/connections/connections_test.go +++ b/lib/connections/connections_test.go @@ -261,7 +261,7 @@ func TestNextDialRegistryCleanup(t *testing.T) { }, // Threshold reached, but outside of cooldown delay { - attempts: dialCoolDownMaxAttemps, + attempts: dialCoolDownMaxAttempts, coolDownIntervalStart: firsts[2], }, } { @@ -281,11 +281,11 @@ func TestNextDialRegistryCleanup(t *testing.T) { }, // attempts at threshold, inside delay { - attempts: dialCoolDownMaxAttemps, + attempts: dialCoolDownMaxAttempts, coolDownIntervalStart: firsts[0], }, { - attempts: dialCoolDownMaxAttemps, + attempts: dialCoolDownMaxAttempts, coolDownIntervalStart: firsts[1], }, } { diff --git a/lib/connections/service.go b/lib/connections/service.go index 32859553f..55118f8fb 100644 --- a/lib/connections/service.go +++ b/lib/connections/service.go @@ -1196,9 +1196,9 @@ func (r nextDialRegistry) get(device protocol.DeviceID, addr string) time.Time { } const ( - dialCoolDownInterval = 2 * time.Minute - dialCoolDownDelay = 5 * time.Minute - dialCoolDownMaxAttemps = 3 + dialCoolDownInterval = 2 * time.Minute + dialCoolDownDelay = 5 * time.Minute + dialCoolDownMaxAttempts = 3 ) // redialDevice marks the device for immediate redial, unless the remote keeps @@ -1217,7 +1217,7 @@ func (r nextDialRegistry) redialDevice(device protocol.DeviceID, now time.Time) return } if dev.attempts == 0 || now.Before(dev.coolDownIntervalStart.Add(dialCoolDownInterval)) { - if dev.attempts >= dialCoolDownMaxAttemps { + if dev.attempts >= dialCoolDownMaxAttempts { // Device has been force redialed too often - let it cool down. return } @@ -1228,7 +1228,7 @@ func (r nextDialRegistry) redialDevice(device protocol.DeviceID, now time.Time) dev.nextDial = make(map[string]time.Time) return } - if dev.attempts >= dialCoolDownMaxAttemps && now.Before(dev.coolDownIntervalStart.Add(dialCoolDownDelay)) { + if dev.attempts >= dialCoolDownMaxAttempts && now.Before(dev.coolDownIntervalStart.Add(dialCoolDownDelay)) { return // Still cooling down } delete(r, device) @@ -1256,7 +1256,7 @@ func (r nextDialRegistry) sleepDurationAndCleanup(now time.Time) time.Duration { } if dev.attempts > 0 { interval := dialCoolDownInterval - if dev.attempts >= dialCoolDownMaxAttemps { + if dev.attempts >= dialCoolDownMaxAttempts { interval = dialCoolDownDelay } if now.After(dev.coolDownIntervalStart.Add(interval)) { diff --git a/lib/fs/filesystem_test.go b/lib/fs/filesystem_test.go index 4a2791ba6..aca8d40f4 100644 --- a/lib/fs/filesystem_test.go +++ b/lib/fs/filesystem_test.go @@ -39,7 +39,7 @@ func TestIsInternal(t *testing.T) { for _, tc := range cases { res := IsInternal(filepath.FromSlash(tc.file)) if res != tc.internal { - t.Errorf("Unexpected result: IsInteral(%q): %v should be %v", tc.file, res, tc.internal) + t.Errorf("Unexpected result: IsInternal(%q): %v should be %v", tc.file, res, tc.internal) } } } diff --git a/lib/protocol/hello.go b/lib/protocol/hello.go index 7e02a19f4..82d66746b 100644 --- a/lib/protocol/hello.go +++ b/lib/protocol/hello.go @@ -20,7 +20,7 @@ var ( // ErrTooOldVersion is returned by ExchangeHello when the other side // speaks an older, incompatible version of the protocol. ErrTooOldVersion = errors.New("the remote device speaks an older version of the protocol not compatible with this version") - // ErrUnknownMagic is returned by ExchangeHellow when the other side + // ErrUnknownMagic is returned by ExchangeHello when the other side // speaks something entirely unknown. ErrUnknownMagic = errors.New("the remote device speaks an unknown (newer?) version of the protocol") ) diff --git a/lib/util/semaphore_test.go b/lib/util/semaphore_test.go index 080be26e5..dd1e56f4a 100644 --- a/lib/util/semaphore_test.go +++ b/lib/util/semaphore_test.go @@ -8,7 +8,7 @@ package util import "testing" -func TestZeroByteSempahore(_ *testing.T) { +func TestZeroByteSemaphore(_ *testing.T) { // A semaphore with zero capacity is just a no-op. s := NewSemaphore(0) @@ -19,7 +19,7 @@ func TestZeroByteSempahore(_ *testing.T) { s.Give(1 << 30) } -func TestByteSempahoreCapChangeUp(t *testing.T) { +func TestByteSemaphoreCapChangeUp(t *testing.T) { // Waiting takes should unblock when the capacity increases s := NewSemaphore(100) @@ -42,7 +42,7 @@ func TestByteSempahoreCapChangeUp(t *testing.T) { } } -func TestByteSempahoreCapChangeDown1(t *testing.T) { +func TestByteSemaphoreCapChangeDown1(t *testing.T) { // Things should make sense when capacity is adjusted down s := NewSemaphore(100) @@ -63,7 +63,7 @@ func TestByteSempahoreCapChangeDown1(t *testing.T) { } } -func TestByteSempahoreCapChangeDown2(t *testing.T) { +func TestByteSemaphoreCapChangeDown2(t *testing.T) { // Things should make sense when capacity is adjusted down, different case s := NewSemaphore(100) @@ -84,7 +84,7 @@ func TestByteSempahoreCapChangeDown2(t *testing.T) { } } -func TestByteSempahoreGiveMore(t *testing.T) { +func TestByteSemaphoreGiveMore(t *testing.T) { // We shouldn't end up with more available than we have capacity... s := NewSemaphore(100) diff --git a/test/parallell_scan_test.go b/test/parallel_scan_test.go similarity index 100% rename from test/parallell_scan_test.go rename to test/parallel_scan_test.go diff --git a/test/util.go b/test/util.go index 39c4f57ee..f1936dc0e 100644 --- a/test/util.go +++ b/test/util.go @@ -83,7 +83,7 @@ func generateFilesWithTime(dir string, files, maxexp int, srcname string, t0 tim } func generateOneFile(fd io.ReadSeeker, p1 string, s int64, t0 time.Time) error { - src := io.LimitReader(&inifiteReader{fd}, int64(s)) + src := io.LimitReader(&infiniteReader{fd}, int64(s)) dst, err := os.Create(p1) if err != nil { return err @@ -265,11 +265,11 @@ func randomName() string { return fmt.Sprintf("%x", b[:]) } -type inifiteReader struct { +type infiniteReader struct { rd io.ReadSeeker } -func (i *inifiteReader) Read(bs []byte) (int, error) { +func (i *infiniteReader) Read(bs []byte) (int, error) { n, err := i.rd.Read(bs) if err == io.EOF { err = nil