mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 02:48:59 +00:00
all: Remove unused method receivers (#8462)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
parent
388e4db9cd
commit
755d21953f
@ -59,7 +59,7 @@ func (r *crashReceiver) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
// serveGet responds to GET requests by serving the uncompressed report.
|
||||
func (r *crashReceiver) serveGet(fullPath string, w http.ResponseWriter, _ *http.Request) {
|
||||
func (*crashReceiver) serveGet(fullPath string, w http.ResponseWriter, _ *http.Request) {
|
||||
fd, err := os.Open(fullPath)
|
||||
if err != nil {
|
||||
http.Error(w, "Not found", http.StatusNotFound)
|
||||
@ -77,7 +77,7 @@ func (r *crashReceiver) serveGet(fullPath string, w http.ResponseWriter, _ *http
|
||||
|
||||
// serveHead responds to HEAD requests by checking if the named report
|
||||
// already exists in the system.
|
||||
func (r *crashReceiver) serveHead(fullPath string, w http.ResponseWriter, _ *http.Request) {
|
||||
func (*crashReceiver) serveHead(fullPath string, w http.ResponseWriter, _ *http.Request) {
|
||||
if _, err := os.Lstat(fullPath); err != nil {
|
||||
http.Error(w, "Not found", http.StatusNotFound)
|
||||
}
|
||||
@ -136,6 +136,6 @@ func (r *crashReceiver) servePut(reportID, fullPath string, w http.ResponseWrite
|
||||
}
|
||||
|
||||
// 01234567890abcdef... => 01/23
|
||||
func (r *crashReceiver) dirFor(base string) string {
|
||||
func (*crashReceiver) dirFor(base string) string {
|
||||
return filepath.Join(base[0:2], base[2:4])
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ type validationError struct{}
|
||||
func (validationError) VerifyConfiguration(_, _ Configuration) error {
|
||||
return errors.New("some error")
|
||||
}
|
||||
func (c validationError) CommitConfiguration(_, _ Configuration) bool {
|
||||
func (validationError) CommitConfiguration(_, _ Configuration) bool {
|
||||
return true
|
||||
}
|
||||
func (validationError) String() string {
|
||||
|
@ -21,7 +21,7 @@ func (c GUIConfiguration) IsAuthEnabled() bool {
|
||||
return c.AuthMode == AuthModeLDAP || (len(c.User) > 0 && len(c.Password) > 0)
|
||||
}
|
||||
|
||||
func (c GUIConfiguration) IsOverridden() bool {
|
||||
func (GUIConfiguration) IsOverridden() bool {
|
||||
return os.Getenv("STGUIADDRESS") != ""
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ func (lim *limiter) CommitConfiguration(from, to config.Configuration) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (lim *limiter) String() string {
|
||||
func (*limiter) String() string {
|
||||
// required by config.Committer interface
|
||||
return "connections.limiter"
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ func (s *service) connect(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *service) bestDialerPriority(cfg config.Configuration) int {
|
||||
func (*service) bestDialerPriority(cfg config.Configuration) int {
|
||||
bestDialerPriority := worstDialerPriority
|
||||
for _, df := range dialers {
|
||||
if df.Valid(cfg) != nil {
|
||||
|
@ -166,7 +166,7 @@ func (k defaultKeyer) GenerateDeviceFileKey(key, folder, device, name []byte) (d
|
||||
return key, nil
|
||||
}
|
||||
|
||||
func (k defaultKeyer) NameFromDeviceFileKey(key []byte) []byte {
|
||||
func (defaultKeyer) NameFromDeviceFileKey(key []byte) []byte {
|
||||
return key[keyPrefixLen+keyFolderLen+keyDeviceLen:]
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ func (k defaultKeyer) GenerateGlobalVersionKey(key, folder, name []byte) (global
|
||||
return key, nil
|
||||
}
|
||||
|
||||
func (k defaultKeyer) NameFromGlobalVersionKey(key []byte) []byte {
|
||||
func (defaultKeyer) NameFromGlobalVersionKey(key []byte) []byte {
|
||||
return key[keyPrefixLen+keyFolderLen:]
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ func (k defaultKeyer) GenerateBlockMapKey(key, folder, hash, name []byte) (block
|
||||
return key, nil
|
||||
}
|
||||
|
||||
func (k defaultKeyer) NameFromBlockMapKey(key []byte) []byte {
|
||||
func (defaultKeyer) NameFromBlockMapKey(key []byte) []byte {
|
||||
return key[keyPrefixLen+keyFolderLen+keyHashLen:]
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ func (k defaultKeyer) GenerateBlockListMapKey(key, folder, hash, name []byte) (b
|
||||
return key, nil
|
||||
}
|
||||
|
||||
func (k defaultKeyer) NameFromBlockListMapKey(key []byte) []byte {
|
||||
func (defaultKeyer) NameFromBlockListMapKey(key []byte) []byte {
|
||||
return key[keyPrefixLen+keyFolderLen+keyHashLen:]
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ func (k defaultKeyer) GenerateSequenceKey(key, folder []byte, seq int64) (sequen
|
||||
return key, nil
|
||||
}
|
||||
|
||||
func (k defaultKeyer) SequenceFromSequenceKey(key []byte) int64 {
|
||||
func (defaultKeyer) SequenceFromSequenceKey(key []byte) int64 {
|
||||
return int64(binary.BigEndian.Uint64(key[keyPrefixLen+keyFolderLen:]))
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ func (k defaultKeyer) GenerateFolderMetaKey(key, folder []byte) (folderMetaKey,
|
||||
|
||||
type blockListKey []byte
|
||||
|
||||
func (k defaultKeyer) GenerateBlockListKey(key []byte, hash []byte) blockListKey {
|
||||
func (defaultKeyer) GenerateBlockListKey(key []byte, hash []byte) blockListKey {
|
||||
key = resize(key, keyPrefixLen+len(hash))
|
||||
key[0] = KeyTypeBlockList
|
||||
copy(key[keyPrefixLen:], hash)
|
||||
@ -349,7 +349,7 @@ func (k blockListKey) Hash() []byte {
|
||||
|
||||
type versionKey []byte
|
||||
|
||||
func (k defaultKeyer) GenerateVersionKey(key []byte, hash []byte) versionKey {
|
||||
func (defaultKeyer) GenerateVersionKey(key []byte, hash []byte) versionKey {
|
||||
key = resize(key, keyPrefixLen+len(hash))
|
||||
key[0] = KeyTypeVersion
|
||||
copy(key[keyPrefixLen:], hash)
|
||||
@ -374,7 +374,7 @@ func (k defaultKeyer) GeneratePendingFolderKey(key, device, folder []byte) (pend
|
||||
return key, nil
|
||||
}
|
||||
|
||||
func (k defaultKeyer) FolderFromPendingFolderKey(key []byte) []byte {
|
||||
func (defaultKeyer) FolderFromPendingFolderKey(key []byte) []byte {
|
||||
return key[keyPrefixLen+keyDeviceLen:]
|
||||
}
|
||||
|
||||
@ -384,14 +384,14 @@ func (k defaultKeyer) DeviceFromPendingFolderKey(key []byte) ([]byte, bool) {
|
||||
|
||||
type pendingDeviceKey []byte
|
||||
|
||||
func (k defaultKeyer) GeneratePendingDeviceKey(key, device []byte) pendingDeviceKey {
|
||||
func (defaultKeyer) GeneratePendingDeviceKey(key, device []byte) pendingDeviceKey {
|
||||
key = resize(key, keyPrefixLen+len(device))
|
||||
key[0] = KeyTypePendingDevice
|
||||
copy(key[keyPrefixLen:], device)
|
||||
return key
|
||||
}
|
||||
|
||||
func (k defaultKeyer) DeviceFromPendingDeviceKey(key []byte) []byte {
|
||||
func (defaultKeyer) DeviceFromPendingDeviceKey(key []byte) []byte {
|
||||
return key[keyPrefixLen:]
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ func (c *globalClient) sendAnnouncement(ctx context.Context, timer *time.Timer)
|
||||
timer.Reset(defaultReannounceInterval)
|
||||
}
|
||||
|
||||
func (c *globalClient) Cache() map[protocol.DeviceID]CacheEntry {
|
||||
func (*globalClient) Cache() map[protocol.DeviceID]CacheEntry {
|
||||
// The globalClient doesn't do caching
|
||||
return nil
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ func (*noopSubscription) Poll(_ time.Duration) (Event, error) {
|
||||
return Event{}, errNoop
|
||||
}
|
||||
|
||||
func (s *noopSubscription) Mask() EventType {
|
||||
func (*noopSubscription) Mask() EventType {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ var (
|
||||
|
||||
type OptionJunctionsAsDirs struct{}
|
||||
|
||||
func (o *OptionJunctionsAsDirs) apply(fs Filesystem) Filesystem {
|
||||
func (*OptionJunctionsAsDirs) apply(fs Filesystem) Filesystem {
|
||||
if basic, ok := fs.(*BasicFilesystem); !ok {
|
||||
l.Warnln("WithJunctionsAsDirs must only be used with FilesystemTypeBasic")
|
||||
} else {
|
||||
@ -36,7 +36,7 @@ func (o *OptionJunctionsAsDirs) apply(fs Filesystem) Filesystem {
|
||||
return fs
|
||||
}
|
||||
|
||||
func (o *OptionJunctionsAsDirs) String() string {
|
||||
func (*OptionJunctionsAsDirs) String() string {
|
||||
return "junctionsAsDirs"
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ func (f *BasicFilesystem) Create(name string) (File, error) {
|
||||
return basicFile{fd, name}, err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Walk(_ string, _ WalkFunc) error {
|
||||
func (*BasicFilesystem) Walk(_ string, _ WalkFunc) error {
|
||||
// implemented in WalkFilesystem
|
||||
return errors.New("not implemented")
|
||||
}
|
||||
@ -298,7 +298,7 @@ func (f *BasicFilesystem) Usage(name string) (Usage, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Type() FilesystemType {
|
||||
func (*BasicFilesystem) Type() FilesystemType {
|
||||
return FilesystemTypeBasic
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ func (f *BasicFilesystem) Options() []Option {
|
||||
return f.options
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) SameFile(fi1, fi2 FileInfo) bool {
|
||||
func (*BasicFilesystem) SameFile(fi1, fi2 FileInfo) bool {
|
||||
// Like os.SameFile, we always return false unless fi1 and fi2 were created
|
||||
// by this package's Stat/Lstat method.
|
||||
f1, ok1 := fi1.(basicFileInfo)
|
||||
@ -322,11 +322,11 @@ func (f *BasicFilesystem) SameFile(fi1, fi2 FileInfo) bool {
|
||||
return os.SameFile(f1.osFileInfo(), f2.osFileInfo())
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) underlying() (Filesystem, bool) {
|
||||
func (*BasicFilesystem) underlying() (Filesystem, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) wrapperType() filesystemWrapperType {
|
||||
func (*BasicFilesystem) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeNone
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func (f *BasicFilesystem) ReadSymlink(name string) (string, error) {
|
||||
return os.Readlink(name)
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) mkdirAll(path string, perm os.FileMode) error {
|
||||
func (*BasicFilesystem) mkdirAll(path string, perm os.FileMode) error {
|
||||
return os.MkdirAll(path, perm)
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ func (f *BasicFilesystem) Hide(name string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) Roots() ([]string, error) {
|
||||
func (*BasicFilesystem) Roots() ([]string, error) {
|
||||
return []string{"/"}, nil
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ func (f *BasicFilesystem) watchLoop(ctx context.Context, name string, roots []st
|
||||
}
|
||||
}
|
||||
|
||||
func (f *BasicFilesystem) eventType(notifyType notify.Event) EventType {
|
||||
func (*BasicFilesystem) eventType(notifyType notify.Event) EventType {
|
||||
if notifyType&rmEventMask != 0 {
|
||||
return Remove
|
||||
}
|
||||
|
@ -627,10 +627,10 @@ func (e fakeEventInfo) Path() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e fakeEventInfo) Event() notify.Event {
|
||||
func (fakeEventInfo) Event() notify.Event {
|
||||
return notify.Write
|
||||
}
|
||||
|
||||
func (e fakeEventInfo) Sys() interface{} {
|
||||
func (fakeEventInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
@ -131,11 +131,11 @@ var globalCaseFilesystemRegistry = caseFilesystemRegistry{fss: make(map[fskey]*c
|
||||
// used if the filesystem is known to already behave case-sensitively.
|
||||
type OptionDetectCaseConflicts struct{}
|
||||
|
||||
func (o *OptionDetectCaseConflicts) apply(fs Filesystem) Filesystem {
|
||||
func (*OptionDetectCaseConflicts) apply(fs Filesystem) Filesystem {
|
||||
return globalCaseFilesystemRegistry.get(fs)
|
||||
}
|
||||
|
||||
func (o *OptionDetectCaseConflicts) String() string {
|
||||
func (*OptionDetectCaseConflicts) String() string {
|
||||
return "detectCaseConflicts"
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ func (f *caseFilesystem) underlying() (Filesystem, bool) {
|
||||
return f.Filesystem, true
|
||||
}
|
||||
|
||||
func (f *caseFilesystem) wrapperType() filesystemWrapperType {
|
||||
func (*caseFilesystem) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeCase
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ func (fs *errorFilesystem) Remove(_ string) error { retur
|
||||
func (fs *errorFilesystem) RemoveAll(_ string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Rename(_, _ string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Stat(_ string) (FileInfo, error) { return nil, fs.err }
|
||||
func (fs *errorFilesystem) SymlinksSupported() bool { return false }
|
||||
func (*errorFilesystem) SymlinksSupported() bool { return false }
|
||||
func (fs *errorFilesystem) Walk(_ string, _ WalkFunc) error { return fs.err }
|
||||
func (fs *errorFilesystem) Unhide(_ string) error { return fs.err }
|
||||
func (fs *errorFilesystem) Hide(_ string) error { return fs.err }
|
||||
@ -47,10 +47,10 @@ func (fs *errorFilesystem) Roots() ([]string, error) { retur
|
||||
func (fs *errorFilesystem) Usage(_ string) (Usage, error) { return Usage{}, fs.err }
|
||||
func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType }
|
||||
func (fs *errorFilesystem) URI() string { return fs.uri }
|
||||
func (fs *errorFilesystem) Options() []Option {
|
||||
func (*errorFilesystem) Options() []Option {
|
||||
return nil
|
||||
}
|
||||
func (fs *errorFilesystem) SameFile(_, _ FileInfo) bool { return false }
|
||||
func (*errorFilesystem) SameFile(_, _ FileInfo) bool { return false }
|
||||
func (fs *errorFilesystem) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
|
||||
return nil, nil, fs.err
|
||||
}
|
||||
@ -58,10 +58,10 @@ func (fs *errorFilesystem) PlatformData(_ string) (protocol.PlatformData, error)
|
||||
return protocol.PlatformData{}, fs.err
|
||||
}
|
||||
|
||||
func (fs *errorFilesystem) underlying() (Filesystem, bool) {
|
||||
func (*errorFilesystem) underlying() (Filesystem, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (fs *errorFilesystem) wrapperType() filesystemWrapperType {
|
||||
func (*errorFilesystem) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeError
|
||||
}
|
||||
|
@ -597,23 +597,23 @@ func (fs *fakeFS) Stat(name string) (FileInfo, error) {
|
||||
return fs.Lstat(name)
|
||||
}
|
||||
|
||||
func (fs *fakeFS) SymlinksSupported() bool {
|
||||
func (*fakeFS) SymlinksSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Walk(_ string, _ WalkFunc) error {
|
||||
func (*fakeFS) Walk(_ string, _ WalkFunc) error {
|
||||
return errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
|
||||
func (*fakeFS) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
|
||||
return nil, nil, ErrWatchNotSupported
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Hide(_ string) error {
|
||||
func (*fakeFS) Hide(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Unhide(_ string) error {
|
||||
func (*fakeFS) Unhide(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -622,15 +622,15 @@ func (fs *fakeFS) Glob(_ string) ([]string, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Roots() ([]string, error) {
|
||||
func (*fakeFS) Roots() ([]string, error) {
|
||||
return []string{"/"}, nil
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Usage(_ string) (Usage, error) {
|
||||
func (*fakeFS) Usage(_ string) (Usage, error) {
|
||||
return Usage{}, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Type() FilesystemType {
|
||||
func (*fakeFS) Type() FilesystemType {
|
||||
return FilesystemTypeFake
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ func (fs *fakeFS) URI() string {
|
||||
return fs.uri
|
||||
}
|
||||
|
||||
func (fs *fakeFS) Options() []Option {
|
||||
func (*fakeFS) Options() []Option {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -661,11 +661,11 @@ func (fs *fakeFS) PlatformData(name string) (protocol.PlatformData, error) {
|
||||
return unixPlatformData(fs, name)
|
||||
}
|
||||
|
||||
func (fs *fakeFS) underlying() (Filesystem, bool) {
|
||||
func (*fakeFS) underlying() (Filesystem, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (fs *fakeFS) wrapperType() filesystemWrapperType {
|
||||
func (*fakeFS) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeNone
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ type fakeFile struct {
|
||||
presentedName string // present (i.e. != "") on insensitive fs only
|
||||
}
|
||||
|
||||
func (f *fakeFile) Close() error {
|
||||
func (*fakeFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -912,7 +912,7 @@ func (f *fakeFile) Stat() (FileInfo, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (f *fakeFile) Sync() error {
|
||||
func (*fakeFile) Sync() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -168,6 +168,6 @@ func (fs *logFilesystem) underlying() (Filesystem, bool) {
|
||||
return fs.Filesystem, true
|
||||
}
|
||||
|
||||
func (fs *logFilesystem) wrapperType() filesystemWrapperType {
|
||||
func (*logFilesystem) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeLog
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ func (f *mtimeFS) underlying() (Filesystem, bool) {
|
||||
return f.Filesystem, true
|
||||
}
|
||||
|
||||
func (f *mtimeFS) wrapperType() filesystemWrapperType {
|
||||
func (*mtimeFS) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeMtime
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,6 @@ func (f *walkFilesystem) underlying() (Filesystem, bool) {
|
||||
return f.Filesystem, true
|
||||
}
|
||||
|
||||
func (f *walkFilesystem) wrapperType() filesystemWrapperType {
|
||||
func (*walkFilesystem) wrapperType() filesystemWrapperType {
|
||||
return filesystemWrapperTypeWalk
|
||||
}
|
||||
|
@ -237,11 +237,11 @@ func (f *folder) Serve(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *folder) BringToFront(string) {}
|
||||
func (*folder) BringToFront(string) {}
|
||||
|
||||
func (f *folder) Override() {}
|
||||
func (*folder) Override() {}
|
||||
|
||||
func (f *folder) Revert() {}
|
||||
func (*folder) Revert() {}
|
||||
|
||||
func (f *folder) DelayScan(next time.Duration) {
|
||||
select {
|
||||
@ -275,7 +275,7 @@ func (f *folder) SchedulePull() {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *folder) Jobs(_, _ int) ([]string, []string, int) {
|
||||
func (*folder) Jobs(_, _ int) ([]string, []string, int) {
|
||||
return nil, nil, 0
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ func newSendOnlyFolder(model *model, fset *db.FileSet, ignores *ignore.Matcher,
|
||||
return f
|
||||
}
|
||||
|
||||
func (f *sendOnlyFolder) PullErrors() []FileError {
|
||||
func (*sendOnlyFolder) PullErrors() []FileError {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1462,7 +1462,7 @@ func (f *sendReceiveFolder) initWeakHashFinder(state copyBlocksState) (*weakhash
|
||||
return weakHashFinder, file
|
||||
}
|
||||
|
||||
func (f *sendReceiveFolder) verifyBuffer(buf []byte, block protocol.BlockInfo) error {
|
||||
func (*sendReceiveFolder) verifyBuffer(buf []byte, block protocol.BlockInfo) error {
|
||||
if len(buf) != int(block.Size) {
|
||||
return fmt.Errorf("length mismatch %d != %d", len(buf), block.Size)
|
||||
}
|
||||
|
@ -1604,7 +1604,7 @@ func (m *model) handleIntroductions(introducerCfg config.DeviceConfiguration, cm
|
||||
}
|
||||
|
||||
// handleDeintroductions handles removals of devices/shares that are removed by an introducer device
|
||||
func (m *model) handleDeintroductions(introducerCfg config.DeviceConfiguration, foldersDevices folderDeviceSet, folders map[string]config.FolderConfiguration, devices map[protocol.DeviceID]config.DeviceConfiguration) (map[string]config.FolderConfiguration, map[protocol.DeviceID]config.DeviceConfiguration, bool) {
|
||||
func (*model) handleDeintroductions(introducerCfg config.DeviceConfiguration, foldersDevices folderDeviceSet, folders map[string]config.FolderConfiguration, devices map[protocol.DeviceID]config.DeviceConfiguration) (map[string]config.FolderConfiguration, map[protocol.DeviceID]config.DeviceConfiguration, bool) {
|
||||
if introducerCfg.SkipIntroductionRemovals {
|
||||
return folders, devices, false
|
||||
}
|
||||
@ -2777,7 +2777,7 @@ func (m *model) String() string {
|
||||
return fmt.Sprintf("model@%p", m)
|
||||
}
|
||||
|
||||
func (m *model) VerifyConfiguration(from, to config.Configuration) error {
|
||||
func (*model) VerifyConfiguration(from, to config.Configuration) error {
|
||||
toFolders := to.FolderMap()
|
||||
for _, from := range from.Folders {
|
||||
to, ok := toFolders[from.ID]
|
||||
|
@ -167,11 +167,11 @@ func negotiateTLS(cert tls.Certificate, conn0, conn1 net.Conn) (net.Conn, net.Co
|
||||
|
||||
type fakeModel struct{}
|
||||
|
||||
func (m *fakeModel) Index(_ DeviceID, _ string, _ []FileInfo) error {
|
||||
func (*fakeModel) Index(_ DeviceID, _ string, _ []FileInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *fakeModel) IndexUpdate(_ DeviceID, _ string, _ []FileInfo) error {
|
||||
func (*fakeModel) IndexUpdate(_ DeviceID, _ string, _ []FileInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -184,13 +184,13 @@ func (m *fakeModel) Request(_ DeviceID, _, _ string, _, size int32, offset int64
|
||||
return &fakeRequestResponse{buf}, nil
|
||||
}
|
||||
|
||||
func (m *fakeModel) ClusterConfig(_ DeviceID, _ ClusterConfig) error {
|
||||
func (*fakeModel) ClusterConfig(_ DeviceID, _ ClusterConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *fakeModel) Closed(DeviceID, error) {
|
||||
func (*fakeModel) Closed(DeviceID, error) {
|
||||
}
|
||||
|
||||
func (m *fakeModel) DownloadProgress(_ DeviceID, _ string, _ []FileDownloadProgressUpdate) error {
|
||||
func (*fakeModel) DownloadProgress(_ DeviceID, _ string, _ []FileDownloadProgressUpdate) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ type FileIntf interface {
|
||||
ModTime() time.Time
|
||||
}
|
||||
|
||||
func (m Hello) Magic() uint32 {
|
||||
func (Hello) Magic() uint32 {
|
||||
return HelloMessageMagic
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ func (t *TestModel) Index(deviceID DeviceID, folder string, files []FileInfo) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TestModel) IndexUpdate(_ DeviceID, _ string, _ []FileInfo) error {
|
||||
func (*TestModel) IndexUpdate(_ DeviceID, _ string, _ []FileInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ func (t *TestModel) ClusterConfig(deviceID DeviceID, config ClusterConfig) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TestModel) DownloadProgress(DeviceID, string, []FileDownloadProgressUpdate) error {
|
||||
func (*TestModel) DownloadProgress(DeviceID, string, []FileDownloadProgressUpdate) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -82,6 +82,6 @@ func (r *fakeRequestResponse) Data() []byte {
|
||||
return r.data
|
||||
}
|
||||
|
||||
func (r *fakeRequestResponse) Close() {}
|
||||
func (*fakeRequestResponse) Close() {}
|
||||
|
||||
func (r *fakeRequestResponse) Wait() {}
|
||||
func (*fakeRequestResponse) Wait() {}
|
||||
|
@ -562,8 +562,8 @@ func (r rawResponse) Data() []byte {
|
||||
return r.data
|
||||
}
|
||||
|
||||
func (r rawResponse) Close() {}
|
||||
func (r rawResponse) Wait() {}
|
||||
func (rawResponse) Close() {}
|
||||
func (rawResponse) Wait() {}
|
||||
|
||||
// IsEncryptedParent returns true if the path points at a parent directory of
|
||||
// encrypted data, i.e. is not a "real" directory. This is determined by
|
||||
|
@ -33,7 +33,7 @@ func newSecureSource() *secureSource {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *secureSource) Seed(int64) {
|
||||
func (*secureSource) Seed(int64) {
|
||||
panic("SecureSource is not seedable")
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,7 @@ func (p *Process) Model(folder string) (Model, error) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (p *Process) readResponse(resp *http.Response) ([]byte, error) {
|
||||
func (*Process) readResponse(resp *http.Response) ([]byte, error) {
|
||||
bs, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err != nil {
|
||||
|
@ -31,7 +31,7 @@ struct header {
|
||||
|
||||
*/
|
||||
|
||||
func (o header) XDRSize() int {
|
||||
func (header) XDRSize() int {
|
||||
return 4 + 4 + 4
|
||||
}
|
||||
|
||||
@ -78,26 +78,26 @@ struct Ping {
|
||||
|
||||
*/
|
||||
|
||||
func (o Ping) XDRSize() int {
|
||||
func (Ping) XDRSize() int {
|
||||
return 0
|
||||
}
|
||||
func (o Ping) MarshalXDR() ([]byte, error) {
|
||||
func (Ping) MarshalXDR() ([]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Ping) MustMarshalXDR() []byte {
|
||||
func (Ping) MustMarshalXDR() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o Ping) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
func (Ping) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Ping) UnmarshalXDR(_ []byte) error {
|
||||
func (*Ping) UnmarshalXDR(_ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Ping) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
func (*Ping) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -112,26 +112,26 @@ struct Pong {
|
||||
|
||||
*/
|
||||
|
||||
func (o Pong) XDRSize() int {
|
||||
func (Pong) XDRSize() int {
|
||||
return 0
|
||||
}
|
||||
func (o Pong) MarshalXDR() ([]byte, error) {
|
||||
func (Pong) MarshalXDR() ([]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o Pong) MustMarshalXDR() []byte {
|
||||
func (Pong) MustMarshalXDR() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o Pong) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
func (Pong) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Pong) UnmarshalXDR(_ []byte) error {
|
||||
func (*Pong) UnmarshalXDR(_ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *Pong) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
func (*Pong) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -146,26 +146,26 @@ struct JoinRelayRequest {
|
||||
|
||||
*/
|
||||
|
||||
func (o JoinRelayRequest) XDRSize() int {
|
||||
func (JoinRelayRequest) XDRSize() int {
|
||||
return 0
|
||||
}
|
||||
func (o JoinRelayRequest) MarshalXDR() ([]byte, error) {
|
||||
func (JoinRelayRequest) MarshalXDR() ([]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o JoinRelayRequest) MustMarshalXDR() []byte {
|
||||
func (JoinRelayRequest) MustMarshalXDR() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o JoinRelayRequest) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
func (JoinRelayRequest) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *JoinRelayRequest) UnmarshalXDR(_ []byte) error {
|
||||
func (*JoinRelayRequest) UnmarshalXDR(_ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *JoinRelayRequest) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
func (*JoinRelayRequest) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -180,26 +180,26 @@ struct RelayFull {
|
||||
|
||||
*/
|
||||
|
||||
func (o RelayFull) XDRSize() int {
|
||||
func (RelayFull) XDRSize() int {
|
||||
return 0
|
||||
}
|
||||
func (o RelayFull) MarshalXDR() ([]byte, error) {
|
||||
func (RelayFull) MarshalXDR() ([]byte, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (o RelayFull) MustMarshalXDR() []byte {
|
||||
func (RelayFull) MustMarshalXDR() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o RelayFull) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
func (RelayFull) MarshalXDRInto(_ *xdr.Marshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RelayFull) UnmarshalXDR(_ []byte) error {
|
||||
func (*RelayFull) UnmarshalXDR(_ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *RelayFull) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
func (*RelayFull) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -139,4 +139,4 @@ func (noopHash) Write([]byte) (int, error) { return 0, nil }
|
||||
|
||||
type noopCounter struct{}
|
||||
|
||||
func (c *noopCounter) Update(_ int64) {}
|
||||
func (*noopCounter) Update(_ int64) {}
|
||||
|
@ -55,7 +55,7 @@ func (i infiniteFS) Open(name string) (fs.File, error) {
|
||||
return &fakeFile{name, i.filesize, 0}, nil
|
||||
}
|
||||
|
||||
func (i infiniteFS) PlatformData(_ string) (protocol.PlatformData, error) {
|
||||
func (infiniteFS) PlatformData(_ string) (protocol.PlatformData, error) {
|
||||
return protocol.PlatformData{}, nil
|
||||
}
|
||||
|
||||
@ -101,11 +101,11 @@ func (s singleFileFS) Open(name string) (fs.File, error) {
|
||||
return &fakeFile{s.name, s.filesize, 0}, nil
|
||||
}
|
||||
|
||||
func (s singleFileFS) Options() []fs.Option {
|
||||
func (singleFileFS) Options() []fs.Option {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s singleFileFS) PlatformData(_ string) (protocol.PlatformData, error) {
|
||||
func (singleFileFS) PlatformData(_ string) (protocol.PlatformData, error) {
|
||||
return protocol.PlatformData{}, nil
|
||||
}
|
||||
|
||||
@ -115,16 +115,16 @@ type fakeInfo struct {
|
||||
}
|
||||
|
||||
func (f fakeInfo) Name() string { return f.name }
|
||||
func (f fakeInfo) Mode() fs.FileMode { return 0755 }
|
||||
func (fakeInfo) Mode() fs.FileMode { return 0755 }
|
||||
func (f fakeInfo) Size() int64 { return f.size }
|
||||
func (f fakeInfo) ModTime() time.Time { return time.Unix(1234567890, 0) }
|
||||
func (fakeInfo) ModTime() time.Time { return time.Unix(1234567890, 0) }
|
||||
func (f fakeInfo) IsDir() bool {
|
||||
return strings.Contains(filepath.Base(f.name), "dir") || f.name == "."
|
||||
}
|
||||
func (f fakeInfo) IsRegular() bool { return !f.IsDir() }
|
||||
func (f fakeInfo) IsSymlink() bool { return false }
|
||||
func (f fakeInfo) Owner() int { return 0 }
|
||||
func (f fakeInfo) Group() int { return 0 }
|
||||
func (fakeInfo) IsSymlink() bool { return false }
|
||||
func (fakeInfo) Owner() int { return 0 }
|
||||
func (fakeInfo) Group() int { return 0 }
|
||||
|
||||
type fakeFile struct {
|
||||
name string
|
||||
@ -153,10 +153,10 @@ func (f *fakeFile) Stat() (fs.FileInfo, error) {
|
||||
return fakeInfo{f.name, f.size}, nil
|
||||
}
|
||||
|
||||
func (f *fakeFile) Write([]byte) (int, error) { return 0, errNotSupp }
|
||||
func (f *fakeFile) WriteAt([]byte, int64) (int, error) { return 0, errNotSupp }
|
||||
func (f *fakeFile) Close() error { return nil }
|
||||
func (f *fakeFile) Truncate(_ int64) error { return errNotSupp }
|
||||
func (f *fakeFile) ReadAt([]byte, int64) (int, error) { return 0, errNotSupp }
|
||||
func (f *fakeFile) Seek(int64, int) (int64, error) { return 0, errNotSupp }
|
||||
func (f *fakeFile) Sync() error { return nil }
|
||||
func (*fakeFile) Write([]byte) (int, error) { return 0, errNotSupp }
|
||||
func (*fakeFile) WriteAt([]byte, int64) (int, error) { return 0, errNotSupp }
|
||||
func (*fakeFile) Close() error { return nil }
|
||||
func (*fakeFile) Truncate(_ int64) error { return errNotSupp }
|
||||
func (*fakeFile) ReadAt([]byte, int64) (int, error) { return 0, errNotSupp }
|
||||
func (*fakeFile) Seek(int64, int) (int64, error) { return 0, errNotSupp }
|
||||
func (*fakeFile) Sync() error { return nil }
|
||||
|
@ -44,7 +44,7 @@ func (f *stunFilter) ClaimIncoming(in []byte, _ net.Addr) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (f *stunFilter) isStunPayload(data []byte) bool {
|
||||
func (*stunFilter) isStunPayload(data []byte) bool {
|
||||
// Need at least 20 bytes
|
||||
if len(data) < 20 {
|
||||
return false
|
||||
|
@ -51,7 +51,7 @@ func (e *FatalErr) Unwrap() error {
|
||||
return e.Err
|
||||
}
|
||||
|
||||
func (e *FatalErr) Is(target error) bool {
|
||||
func (*FatalErr) Is(target error) bool {
|
||||
return target == suture.ErrTerminateSupervisorTree
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ func (e *noRestartErr) Unwrap() error {
|
||||
return e.err
|
||||
}
|
||||
|
||||
func (e *noRestartErr) Is(target error) bool {
|
||||
func (*noRestartErr) Is(target error) bool {
|
||||
return target == suture.ErrDoNotRestart
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ func (s *verboseService) Serve(ctx context.Context) error {
|
||||
|
||||
var folderSummaryRemoveDeprecatedRe = regexp.MustCompile(`(Invalid|IgnorePatterns|StateChanged):\S+\s?`)
|
||||
|
||||
func (s *verboseService) formatEvent(ev events.Event) string {
|
||||
func (*verboseService) formatEvent(ev events.Event) string {
|
||||
switch ev.Type {
|
||||
case events.DownloadProgress, events.LocalIndexUpdated:
|
||||
// Skip
|
||||
|
@ -45,11 +45,11 @@ func (rw *BlockingRW) Close() error {
|
||||
// NoopRW implements io.Reader and Writer but never returns when called
|
||||
type NoopRW struct{}
|
||||
|
||||
func (rw *NoopRW) Read(p []byte) (n int, err error) {
|
||||
func (*NoopRW) Read(p []byte) (n int, err error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (rw *NoopRW) Write(p []byte) (n int, err error) {
|
||||
func (*NoopRW) Write(p []byte) (n int, err error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ func (r *Report) FieldPointers() []interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Report) FieldNames() []string {
|
||||
func (*Report) FieldNames() []string {
|
||||
// The database fields that back this struct in PostgreSQL
|
||||
return []string{
|
||||
// V1
|
||||
|
@ -195,7 +195,7 @@ func (h *failureHandler) CommitConfiguration(from, to config.Configuration) bool
|
||||
return true
|
||||
}
|
||||
|
||||
func (h *failureHandler) String() string {
|
||||
func (*failureHandler) String() string {
|
||||
return "FailureHandler"
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ func (s *Service) reportData(ctx context.Context, urVersion int, preview bool) (
|
||||
return report, nil
|
||||
}
|
||||
|
||||
func (s *Service) UptimeS() int {
|
||||
func (*Service) UptimeS() int {
|
||||
return int(time.Since(StartTime).Seconds())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user