all: Unused parameter should be replaced by underscore (#8464)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
deepsource-autofix[bot] 2022-07-28 17:17:29 +02:00 committed by GitHub
parent 7bdb5faa9c
commit 5130c414da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 90 additions and 90 deletions

View File

@ -68,7 +68,7 @@ func newAPISrv(addr string, cert tls.Certificate, db database, repl replicator,
} }
} }
func (s *apiSrv) Serve(ctx context.Context) error { func (s *apiSrv) Serve(_ context.Context) error {
if s.useHTTP { if s.useHTTP {
listener, err := net.Listen("tcp", s.addr) listener, err := net.Listen("tcp", s.addr)
if err != nil { if err != nil {
@ -302,7 +302,7 @@ func (s *apiSrv) handleAnnounce(deviceID protocol.DeviceID, addresses []string)
return s.db.merge(key, dbAddrs, seen) return s.db.merge(key, dbAddrs, seen)
} }
func handlePing(w http.ResponseWriter, r *http.Request) { func handlePing(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(204) w.WriteHeader(204)
} }

View File

@ -135,7 +135,7 @@ func (s *replicationSender) String() string {
return fmt.Sprintf("replicationSender(%q)", s.dst) return fmt.Sprintf("replicationSender(%q)", s.dst)
} }
func (s *replicationSender) send(key string, ps []DatabaseAddress, seen int64) { func (s *replicationSender) send(key string, ps []DatabaseAddress, _ int64) {
item := ReplicationRecord{ item := ReplicationRecord{
Key: key, Key: key,
Addresses: ps, Addresses: ps,

View File

@ -23,7 +23,7 @@ var (
numConnections int64 numConnections int64
) )
func listener(proto, addr string, config *tls.Config) { func listener(_, addr string, config *tls.Config) {
tcpListener, err := net.Listen("tcp", addr) tcpListener, err := net.Listen("tcp", addr)
if err != nil { if err != nil {
log.Fatalln(err) log.Fatalln(err)

View File

@ -36,7 +36,7 @@ func statusService(addr string) {
} }
} }
func getStatus(w http.ResponseWriter, r *http.Request) { func getStatus(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
status := make(map[string]interface{}) status := make(map[string]interface{})

View File

@ -60,7 +60,7 @@ func (h *configHandler) configBefore(c *cli.Context) error {
return h.err return h.err
} }
func (h *configHandler) configAfter(c *cli.Context) error { func (h *configHandler) configAfter(_ *cli.Context) error {
if h.err != nil { if h.err != nil {
// Error was already returned in configBefore // Error was already returned in configBefore
return nil return nil

View File

@ -284,7 +284,7 @@ func rootHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) {
} }
} }
func locationsHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) { func locationsHandler(db *sql.DB, w http.ResponseWriter, _ *http.Request) {
cacheMut.Lock() cacheMut.Lock()
defer cacheMut.Unlock() defer cacheMut.Unlock()
@ -377,7 +377,7 @@ func summaryHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) {
w.Write(bs) w.Write(bs)
} }
func movementHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) { func movementHandler(db *sql.DB, w http.ResponseWriter, _ *http.Request) {
s, err := getMovement(db) s, err := getMovement(db)
if err != nil { if err != nil {
log.Println("movementHandler:", err) log.Println("movementHandler:", err)
@ -396,7 +396,7 @@ func movementHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) {
w.Write(bs) w.Write(bs)
} }
func performanceHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) { func performanceHandler(db *sql.DB, w http.ResponseWriter, _ *http.Request) {
s, err := getPerformance(db) s, err := getPerformance(db)
if err != nil { if err != nil {
log.Println("performanceHandler:", err) log.Println("performanceHandler:", err)
@ -415,7 +415,7 @@ func performanceHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) {
w.Write(bs) w.Write(bs)
} }
func blockStatsHandler(db *sql.DB, w http.ResponseWriter, r *http.Request) { func blockStatsHandler(db *sql.DB, w http.ResponseWriter, _ *http.Request) {
s, err := getBlockStats(db) s, err := getBlockStats(db)
if err != nil { if err != nil {
log.Println("blockStatsHandler:", err) log.Println("blockStatsHandler:", err)

View File

@ -218,7 +218,7 @@ func (f *quicListenerFactory) Valid(config.Configuration) error {
return nil return nil
} }
func (f *quicListenerFactory) New(uri *url.URL, cfg config.Wrapper, tlsCfg *tls.Config, conns chan internalConn, natService *nat.Service, registry *registry.Registry) genericListener { func (f *quicListenerFactory) New(uri *url.URL, cfg config.Wrapper, tlsCfg *tls.Config, conns chan internalConn, _ *nat.Service, registry *registry.Registry) genericListener {
l := &quicListener{ l := &quicListener{
uri: fixupPort(uri, config.DefaultQUICPort), uri: fixupPort(uri, config.DefaultQUICPort),
cfg: cfg, cfg: cfg,
@ -232,6 +232,6 @@ func (f *quicListenerFactory) New(uri *url.URL, cfg config.Wrapper, tlsCfg *tls.
return l return l
} }
func (quicListenerFactory) Enabled(cfg config.Configuration) bool { func (quicListenerFactory) Enabled(_ config.Configuration) bool {
return true return true
} }

View File

@ -178,7 +178,7 @@ func (t *relayListener) NATType() string {
type relayListenerFactory struct{} type relayListenerFactory struct{}
func (f *relayListenerFactory) New(uri *url.URL, cfg config.Wrapper, tlsCfg *tls.Config, conns chan internalConn, natService *nat.Service, _ *registry.Registry) genericListener { func (f *relayListenerFactory) New(uri *url.URL, cfg config.Wrapper, tlsCfg *tls.Config, conns chan internalConn, _ *nat.Service, _ *registry.Registry) genericListener {
t := &relayListener{ t := &relayListener{
uri: uri, uri: uri,
cfg: cfg, cfg: cfg,

View File

@ -519,7 +519,7 @@ func (db *schemaUpdater) updateSchema6to7(_ int) error {
return t.Commit() return t.Commit()
} }
func (db *schemaUpdater) updateSchemaTo9(prev int) error { func (db *schemaUpdater) updateSchemaTo9(_ int) error {
// Loads and rewrites all files with blocks, to deduplicate block lists. // Loads and rewrites all files with blocks, to deduplicate block lists.
t, err := db.newReadWriteTransaction() t, err := db.newReadWriteTransaction()

View File

@ -79,7 +79,7 @@ type fakeDiscovery struct {
addresses []string addresses []string
} }
func (f *fakeDiscovery) Lookup(_ context.Context, deviceID protocol.DeviceID) (addresses []string, err error) { func (f *fakeDiscovery) Lookup(_ context.Context, _ protocol.DeviceID) (addresses []string, err error) {
return f.addresses, nil return f.addresses, nil
} }
@ -127,7 +127,7 @@ type slowDiscovery struct {
started chan struct{} started chan struct{}
} }
func (f *slowDiscovery) Lookup(_ context.Context, deviceID protocol.DeviceID) (addresses []string, err error) { func (f *slowDiscovery) Lookup(_ context.Context, _ protocol.DeviceID) (addresses []string, err error) {
close(f.started) close(f.started)
time.Sleep(f.delay) time.Sleep(f.delay)
return nil, nil return nil, nil

View File

@ -551,11 +551,11 @@ type noopLogger struct{}
var NoopLogger Logger = &noopLogger{} var NoopLogger Logger = &noopLogger{}
func (*noopLogger) Serve(ctx context.Context) error { return nil } func (*noopLogger) Serve(_ context.Context) error { return nil }
func (*noopLogger) Log(t EventType, data interface{}) {} func (*noopLogger) Log(_ EventType, _ interface{}) {}
func (*noopLogger) Subscribe(mask EventType) Subscription { func (*noopLogger) Subscribe(_ EventType) Subscription {
return &noopSubscription{} return &noopSubscription{}
} }
@ -565,7 +565,7 @@ func (*noopSubscription) C() <-chan Event {
return nil return nil
} }
func (*noopSubscription) Poll(timeout time.Duration) (Event, error) { func (*noopSubscription) Poll(_ time.Duration) (Event, error) {
return Event{}, errNoop return Event{}, errNoop
} }

View File

@ -265,7 +265,7 @@ func (f *BasicFilesystem) Create(name string) (File, error) {
return basicFile{fd, name}, err return basicFile{fd, name}, err
} }
func (f *BasicFilesystem) Walk(root string, walkFn WalkFunc) error { func (f *BasicFilesystem) Walk(_ string, _ WalkFunc) error {
// implemented in WalkFilesystem // implemented in WalkFilesystem
return errors.New("not implemented") return errors.New("not implemented")
} }

View File

@ -19,42 +19,42 @@ type errorFilesystem struct {
uri string uri string
} }
func (fs *errorFilesystem) Chmod(name string, mode FileMode) error { return fs.err } func (fs *errorFilesystem) Chmod(_ string, _ FileMode) error { return fs.err }
func (fs *errorFilesystem) Lchown(name, uid, gid string) error { return fs.err } func (fs *errorFilesystem) Lchown(_, _, _ string) error { return fs.err }
func (fs *errorFilesystem) Chtimes(name string, atime time.Time, mtime time.Time) error { func (fs *errorFilesystem) Chtimes(_ string, _ time.Time, _ time.Time) error {
return fs.err return fs.err
} }
func (fs *errorFilesystem) Create(name string) (File, error) { return nil, fs.err } func (fs *errorFilesystem) Create(_ string) (File, error) { return nil, fs.err }
func (fs *errorFilesystem) CreateSymlink(target, name string) error { return fs.err } func (fs *errorFilesystem) CreateSymlink(_, _ string) error { return fs.err }
func (fs *errorFilesystem) DirNames(name string) ([]string, error) { return nil, fs.err } func (fs *errorFilesystem) DirNames(_ string) ([]string, error) { return nil, fs.err }
func (fs *errorFilesystem) Lstat(name string) (FileInfo, error) { return nil, fs.err } func (fs *errorFilesystem) Lstat(_ string) (FileInfo, error) { return nil, fs.err }
func (fs *errorFilesystem) Mkdir(name string, perm FileMode) error { return fs.err } func (fs *errorFilesystem) Mkdir(_ string, _ FileMode) error { return fs.err }
func (fs *errorFilesystem) MkdirAll(name string, perm FileMode) error { return fs.err } func (fs *errorFilesystem) MkdirAll(_ string, _ FileMode) error { return fs.err }
func (fs *errorFilesystem) Open(name string) (File, error) { return nil, fs.err } func (fs *errorFilesystem) Open(_ string) (File, error) { return nil, fs.err }
func (fs *errorFilesystem) OpenFile(string, int, FileMode) (File, error) { return nil, fs.err } func (fs *errorFilesystem) OpenFile(string, int, FileMode) (File, error) { return nil, fs.err }
func (fs *errorFilesystem) ReadSymlink(name string) (string, error) { return "", fs.err } func (fs *errorFilesystem) ReadSymlink(_ string) (string, error) { return "", fs.err }
func (fs *errorFilesystem) Remove(name string) error { return fs.err } func (fs *errorFilesystem) Remove(_ string) error { return fs.err }
func (fs *errorFilesystem) RemoveAll(name string) error { return fs.err } func (fs *errorFilesystem) RemoveAll(_ string) error { return fs.err }
func (fs *errorFilesystem) Rename(oldname, newname string) error { return fs.err } func (fs *errorFilesystem) Rename(_, _ string) error { return fs.err }
func (fs *errorFilesystem) Stat(name string) (FileInfo, error) { return nil, fs.err } func (fs *errorFilesystem) Stat(_ string) (FileInfo, error) { return nil, fs.err }
func (fs *errorFilesystem) SymlinksSupported() bool { return false } func (fs *errorFilesystem) SymlinksSupported() bool { return false }
func (fs *errorFilesystem) Walk(root string, walkFn WalkFunc) error { return fs.err } func (fs *errorFilesystem) Walk(_ string, _ WalkFunc) error { return fs.err }
func (fs *errorFilesystem) Unhide(name string) error { return fs.err } func (fs *errorFilesystem) Unhide(_ string) error { return fs.err }
func (fs *errorFilesystem) Hide(name string) error { return fs.err } func (fs *errorFilesystem) Hide(_ string) error { return fs.err }
func (fs *errorFilesystem) Glob(pattern string) ([]string, error) { return nil, fs.err } func (fs *errorFilesystem) Glob(_ string) ([]string, error) { return nil, fs.err }
func (fs *errorFilesystem) SyncDir(name string) error { return fs.err } func (fs *errorFilesystem) SyncDir(_ string) error { return fs.err }
func (fs *errorFilesystem) Roots() ([]string, error) { return nil, fs.err } func (fs *errorFilesystem) Roots() ([]string, error) { return nil, fs.err }
func (fs *errorFilesystem) Usage(name string) (Usage, error) { return Usage{}, fs.err } func (fs *errorFilesystem) Usage(_ string) (Usage, error) { return Usage{}, fs.err }
func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType } func (fs *errorFilesystem) Type() FilesystemType { return fs.fsType }
func (fs *errorFilesystem) URI() string { return fs.uri } func (fs *errorFilesystem) URI() string { return fs.uri }
func (fs *errorFilesystem) Options() []Option { func (fs *errorFilesystem) Options() []Option {
return nil return nil
} }
func (fs *errorFilesystem) SameFile(fi1, fi2 FileInfo) bool { return false } func (fs *errorFilesystem) SameFile(_, _ FileInfo) bool { return false }
func (fs *errorFilesystem) Watch(path string, ignore Matcher, ctx context.Context, ignorePerms bool) (<-chan Event, <-chan error, error) { func (fs *errorFilesystem) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
return nil, nil, fs.err return nil, nil, fs.err
} }
func (fs *errorFilesystem) PlatformData(name string) (protocol.PlatformData, error) { func (fs *errorFilesystem) PlatformData(_ string) (protocol.PlatformData, error) {
return protocol.PlatformData{}, fs.err return protocol.PlatformData{}, fs.err
} }

View File

@ -235,7 +235,7 @@ func (fs *fakeFS) Lchown(name, uid, gid string) error {
return nil return nil
} }
func (fs *fakeFS) Chtimes(name string, atime time.Time, mtime time.Time) error { func (fs *fakeFS) Chtimes(name string, _ time.Time, mtime time.Time) error {
fs.mut.Lock() fs.mut.Lock()
defer fs.mut.Unlock() defer fs.mut.Unlock()
fs.counters.Chtimes++ fs.counters.Chtimes++
@ -601,23 +601,23 @@ func (fs *fakeFS) SymlinksSupported() bool {
return false return false
} }
func (fs *fakeFS) Walk(name string, walkFn WalkFunc) error { func (fs *fakeFS) Walk(_ string, _ WalkFunc) error {
return errors.New("not implemented") return errors.New("not implemented")
} }
func (fs *fakeFS) Watch(path string, ignore Matcher, ctx context.Context, ignorePerms bool) (<-chan Event, <-chan error, error) { func (fs *fakeFS) Watch(_ string, _ Matcher, _ context.Context, _ bool) (<-chan Event, <-chan error, error) {
return nil, nil, ErrWatchNotSupported return nil, nil, ErrWatchNotSupported
} }
func (fs *fakeFS) Hide(name string) error { func (fs *fakeFS) Hide(_ string) error {
return nil return nil
} }
func (fs *fakeFS) Unhide(name string) error { func (fs *fakeFS) Unhide(_ string) error {
return nil return nil
} }
func (fs *fakeFS) Glob(pattern string) ([]string, error) { func (fs *fakeFS) Glob(_ string) ([]string, error) {
// gnnh we don't seem to actually require this in practice // gnnh we don't seem to actually require this in practice
return nil, errors.New("not implemented") return nil, errors.New("not implemented")
} }
@ -626,7 +626,7 @@ func (fs *fakeFS) Roots() ([]string, error) {
return []string{"/"}, nil return []string{"/"}, nil
} }
func (fs *fakeFS) Usage(name string) (Usage, error) { func (fs *fakeFS) Usage(_ string) (Usage, error) {
return Usage{}, errors.New("not implemented") return Usage{}, errors.New("not implemented")
} }

View File

@ -245,7 +245,7 @@ func (s mapStore) Delete(key string) error {
} }
// failChtimes does nothing, and fails // failChtimes does nothing, and fails
func failChtimes(name string, mtime, atime time.Time) error { func failChtimes(_ string, _, _ time.Time) error {
return errors.New("no") return errors.New("no")
} }

View File

@ -1806,7 +1806,7 @@ func (r *requestResponse) Wait() {
// Request returns the specified data segment by reading it from local disk. // Request returns the specified data segment by reading it from local disk.
// Implements the protocol.Model interface. // Implements the protocol.Model interface.
func (m *model) Request(deviceID protocol.DeviceID, folder, name string, blockNo, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (out protocol.RequestResponse, err error) { func (m *model) Request(deviceID protocol.DeviceID, folder, name string, _, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (out protocol.RequestResponse, err error) {
if size < 0 || offset < 0 { if size < 0 || offset < 0 {
return nil, protocol.ErrInvalid return nil, protocol.ErrInvalid
} }

View File

@ -45,7 +45,7 @@ func NewService(id protocol.DeviceID, cfg config.Wrapper) *Service {
return s return s
} }
func (s *Service) CommitConfiguration(from, to config.Configuration) bool { func (s *Service) CommitConfiguration(_, to config.Configuration) bool {
s.mut.Lock() s.mut.Lock()
if !s.enabled && to.Options.NATEnabled { if !s.enabled && to.Options.NATEnabled {
l.Debugln("Starting NAT service") l.Debugln("Starting NAT service")

View File

@ -97,7 +97,7 @@ func (w *wrapper) GetLocalIPAddress() net.IP {
return w.localIP return w.localIP
} }
func (w *wrapper) AddPortMapping(ctx context.Context, protocol nat.Protocol, internalPort, externalPort int, description string, duration time.Duration) (int, error) { func (w *wrapper) AddPortMapping(ctx context.Context, protocol nat.Protocol, internalPort, externalPort int, _ string, duration time.Duration) (int, error) {
// NAT-PMP says that if duration is 0, the mapping is actually removed // NAT-PMP says that if duration is 0, the mapping is actually removed
// Swap the zero with the renewal value, which should make the lease for the // Swap the zero with the renewal value, which should make the lease for the
// exact amount of time between the calls. // exact amount of time between the calls.

View File

@ -167,15 +167,15 @@ func negotiateTLS(cert tls.Certificate, conn0, conn1 net.Conn) (net.Conn, net.Co
type fakeModel struct{} type fakeModel struct{}
func (m *fakeModel) Index(deviceID DeviceID, folder string, files []FileInfo) error { func (m *fakeModel) Index(_ DeviceID, _ string, _ []FileInfo) error {
return nil return nil
} }
func (m *fakeModel) IndexUpdate(deviceID DeviceID, folder string, files []FileInfo) error { func (m *fakeModel) IndexUpdate(_ DeviceID, _ string, _ []FileInfo) error {
return nil return nil
} }
func (m *fakeModel) Request(deviceID DeviceID, folder, name string, blockNo, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error) { func (m *fakeModel) Request(_ DeviceID, _, _ string, _, size int32, offset int64, _ []byte, _ uint32, _ bool) (RequestResponse, error) {
// We write the offset to the end of the buffer, so the receiver // We write the offset to the end of the buffer, so the receiver
// can verify that it did in fact get some data back over the // can verify that it did in fact get some data back over the
// connection. // connection.
@ -184,13 +184,13 @@ func (m *fakeModel) Request(deviceID DeviceID, folder, name string, blockNo, siz
return &fakeRequestResponse{buf}, nil return &fakeRequestResponse{buf}, nil
} }
func (m *fakeModel) ClusterConfig(deviceID DeviceID, config ClusterConfig) error { func (m *fakeModel) ClusterConfig(_ DeviceID, _ ClusterConfig) error {
return nil return nil
} }
func (m *fakeModel) Closed(DeviceID, error) { func (m *fakeModel) Closed(DeviceID, error) {
} }
func (m *fakeModel) DownloadProgress(deviceID DeviceID, folder string, updates []FileDownloadProgressUpdate) error { func (m *fakeModel) DownloadProgress(_ DeviceID, _ string, _ []FileDownloadProgressUpdate) error {
return nil return nil
} }

View File

@ -32,11 +32,11 @@ func (t *TestModel) Index(deviceID DeviceID, folder string, files []FileInfo) er
return nil return nil
} }
func (t *TestModel) IndexUpdate(deviceID DeviceID, folder string, files []FileInfo) error { func (t *TestModel) IndexUpdate(_ DeviceID, _ string, _ []FileInfo) error {
return nil return nil
} }
func (t *TestModel) Request(deviceID DeviceID, folder, name string, blockNo, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error) { func (t *TestModel) Request(_ DeviceID, folder, name string, _, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error) {
t.folder = folder t.folder = folder
t.name = name t.name = name
t.offset = offset t.offset = offset

View File

@ -89,15 +89,15 @@ func (o Ping) MustMarshalXDR() []byte {
return nil return nil
} }
func (o Ping) MarshalXDRInto(m *xdr.Marshaller) error { func (o Ping) MarshalXDRInto(_ *xdr.Marshaller) error {
return nil return nil
} }
func (o *Ping) UnmarshalXDR(bs []byte) error { func (o *Ping) UnmarshalXDR(_ []byte) error {
return nil return nil
} }
func (o *Ping) UnmarshalXDRFrom(u *xdr.Unmarshaller) error { func (o *Ping) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
return nil return nil
} }
@ -123,15 +123,15 @@ func (o Pong) MustMarshalXDR() []byte {
return nil return nil
} }
func (o Pong) MarshalXDRInto(m *xdr.Marshaller) error { func (o Pong) MarshalXDRInto(_ *xdr.Marshaller) error {
return nil return nil
} }
func (o *Pong) UnmarshalXDR(bs []byte) error { func (o *Pong) UnmarshalXDR(_ []byte) error {
return nil return nil
} }
func (o *Pong) UnmarshalXDRFrom(u *xdr.Unmarshaller) error { func (o *Pong) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
return nil return nil
} }
@ -157,15 +157,15 @@ func (o JoinRelayRequest) MustMarshalXDR() []byte {
return nil return nil
} }
func (o JoinRelayRequest) MarshalXDRInto(m *xdr.Marshaller) error { func (o JoinRelayRequest) MarshalXDRInto(_ *xdr.Marshaller) error {
return nil return nil
} }
func (o *JoinRelayRequest) UnmarshalXDR(bs []byte) error { func (o *JoinRelayRequest) UnmarshalXDR(_ []byte) error {
return nil return nil
} }
func (o *JoinRelayRequest) UnmarshalXDRFrom(u *xdr.Unmarshaller) error { func (o *JoinRelayRequest) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
return nil return nil
} }
@ -191,15 +191,15 @@ func (o RelayFull) MustMarshalXDR() []byte {
return nil return nil
} }
func (o RelayFull) MarshalXDRInto(m *xdr.Marshaller) error { func (o RelayFull) MarshalXDRInto(_ *xdr.Marshaller) error {
return nil return nil
} }
func (o *RelayFull) UnmarshalXDR(bs []byte) error { func (o *RelayFull) UnmarshalXDR(_ []byte) error {
return nil return nil
} }
func (o *RelayFull) UnmarshalXDRFrom(u *xdr.Unmarshaller) error { func (o *RelayFull) UnmarshalXDRFrom(_ *xdr.Unmarshaller) error {
return nil return nil
} }

View File

@ -139,4 +139,4 @@ func (noopHash) Write([]byte) (int, error) { return 0, nil }
type noopCounter struct{} type noopCounter struct{}
func (c *noopCounter) Update(bytes int64) {} func (c *noopCounter) Update(_ int64) {}

View File

@ -55,7 +55,7 @@ func (i infiniteFS) Open(name string) (fs.File, error) {
return &fakeFile{name, i.filesize, 0}, nil return &fakeFile{name, i.filesize, 0}, nil
} }
func (i infiniteFS) PlatformData(name string) (protocol.PlatformData, error) { func (i infiniteFS) PlatformData(_ string) (protocol.PlatformData, error) {
return protocol.PlatformData{}, nil return protocol.PlatformData{}, nil
} }
@ -105,7 +105,7 @@ func (s singleFileFS) Options() []fs.Option {
return nil return nil
} }
func (s singleFileFS) PlatformData(name string) (protocol.PlatformData, error) { func (s singleFileFS) PlatformData(_ string) (protocol.PlatformData, error) {
return protocol.PlatformData{}, nil return protocol.PlatformData{}, nil
} }
@ -156,7 +156,7 @@ func (f *fakeFile) Stat() (fs.FileInfo, error) {
func (f *fakeFile) Write([]byte) (int, error) { return 0, errNotSupp } func (f *fakeFile) Write([]byte) (int, error) { return 0, errNotSupp }
func (f *fakeFile) WriteAt([]byte, int64) (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) Close() error { return nil }
func (f *fakeFile) Truncate(size int64) error { return errNotSupp } func (f *fakeFile) Truncate(_ int64) error { return errNotSupp }
func (f *fakeFile) ReadAt([]byte, int64) (int, error) { return 0, 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) Seek(int64, int) (int64, error) { return 0, errNotSupp }
func (f *fakeFile) Sync() error { return nil } func (f *fakeFile) Sync() error { return nil }

View File

@ -662,7 +662,7 @@ func (c *byteCounter) Close() {
type noCurrentFiler struct{} type noCurrentFiler struct{}
func (noCurrentFiler) CurrentFile(name string) (protocol.FileInfo, bool) { func (noCurrentFiler) CurrentFile(_ string) (protocol.FileInfo, bool) {
return protocol.FileInfo{}, false return protocol.FileInfo{}, false
} }

View File

@ -310,7 +310,7 @@ func TestNormalizationDarwinCaseFS(t *testing.T) {
} }
} }
func TestIssue1507(t *testing.T) { func TestIssue1507(_ *testing.T) {
w := &walker{} w := &walker{}
w.Matcher = ignore.New(w.Filesystem) w.Matcher = ignore.New(w.Filesystem)
h := make(chan protocol.FileInfo, 100) h := make(chan protocol.FileInfo, 100)

View File

@ -23,7 +23,7 @@ type stunFilter struct {
mut sync.Mutex mut sync.Mutex
} }
func (f *stunFilter) Outgoing(out []byte, addr net.Addr) { func (f *stunFilter) Outgoing(out []byte, _ net.Addr) {
if !f.isStunPayload(out) { if !f.isStunPayload(out) {
panic("not a stun payload") panic("not a stun payload")
} }
@ -33,7 +33,7 @@ func (f *stunFilter) Outgoing(out []byte, addr net.Addr) {
f.mut.Unlock() f.mut.Unlock()
} }
func (f *stunFilter) ClaimIncoming(in []byte, addr net.Addr) bool { func (f *stunFilter) ClaimIncoming(in []byte, _ net.Addr) bool {
if f.isStunPayload(in) { if f.isStunPayload(in) {
f.mut.Lock() f.mut.Lock()
_, ok := f.ids[string(in[8:20])] _, ok := f.ids[string(in[8:20])]

View File

@ -25,12 +25,12 @@ func NewBlockingRW() *BlockingRW {
closeOnce: sync.Once{}, closeOnce: sync.Once{},
} }
} }
func (rw *BlockingRW) Read(p []byte) (int, error) { func (rw *BlockingRW) Read(_ []byte) (int, error) {
<-rw.c <-rw.c
return 0, ErrClosed return 0, ErrClosed
} }
func (rw *BlockingRW) Write(p []byte) (int, error) { func (rw *BlockingRW) Write(_ []byte) (int, error) {
<-rw.c <-rw.c
return 0, ErrClosed return 0, ErrClosed
} }

View File

@ -85,7 +85,7 @@ func (e *UnsupportedDeviceTypeError) Error() string {
// Discover discovers UPnP InternetGatewayDevices. // Discover discovers UPnP InternetGatewayDevices.
// The order in which the devices appear in the results list is not deterministic. // The order in which the devices appear in the results list is not deterministic.
func Discover(ctx context.Context, renewal, timeout time.Duration) []nat.Device { func Discover(ctx context.Context, _, timeout time.Duration) []nat.Device {
var results []nat.Device var results []nat.Device
interfaces, err := net.Interfaces() interfaces, err := net.Interfaces()

View File

@ -8,7 +8,7 @@ package util
import "testing" import "testing"
func TestZeroByteSempahore(t *testing.T) { func TestZeroByteSempahore(_ *testing.T) {
// A semaphore with zero capacity is just a no-op. // A semaphore with zero capacity is just a no-op.
s := NewSemaphore(0) s := NewSemaphore(0)

View File

@ -117,7 +117,7 @@ func (v external) GetVersions() (map[string][]FileVersion, error) {
return nil, ErrRestorationNotSupported return nil, ErrRestorationNotSupported
} }
func (v external) Restore(filePath string, versionTime time.Time) error { func (v external) Restore(_ string, _ time.Time) error {
return ErrRestorationNotSupported return ErrRestorationNotSupported
} }

View File

@ -421,7 +421,7 @@ func (a *aggregator) String() string {
return fmt.Sprintf("aggregator/%s:", a.folderCfg.Description()) return fmt.Sprintf("aggregator/%s:", a.folderCfg.Description())
} }
func (a *aggregator) CommitConfiguration(from, to config.Configuration) bool { func (a *aggregator) CommitConfiguration(_, to config.Configuration) bool {
for _, folderCfg := range to.Folders { for _, folderCfg := range to.Folders {
if folderCfg.ID == a.folderID { if folderCfg.ID == a.folderID {
select { select {

View File

@ -70,7 +70,7 @@ func isGometalinterInstalled() bool {
return true return true
} }
func gometalinter(t *testing.T, dirs []string, excludes ...string) bool { func gometalinter(_ *testing.T, dirs []string, excludes ...string) bool {
params := []string{"--disable-all", "--concurrency=2", "--deadline=300s"} params := []string{"--disable-all", "--concurrency=2", "--deadline=300s"}
for _, linter := range fastLinters { for _, linter := range fastLinters {