From 7f5a13d1851ad8e89e7462b171e7b7146d03c350 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Tue, 19 Jul 2022 23:28:33 +0200 Subject: [PATCH] fix unused parameter lint warnings Signed-off-by: Nicola Murino --- cmd/acme.go | 2 +- cmd/awscontainer_disabled.go | 2 +- cmd/genman.go | 2 +- cmd/initprovider.go | 2 +- cmd/install_windows.go | 2 +- cmd/portable.go | 2 +- cmd/reload_windows.go | 2 +- cmd/resetprovider.go | 2 +- cmd/revertprovider.go | 2 +- cmd/rotatelogs_windows.go | 2 +- cmd/serve.go | 2 +- cmd/smtptest.go | 2 +- cmd/start_windows.go | 2 +- cmd/startsubsys.go | 2 +- cmd/status_windows.go | 2 +- cmd/stop_windows.go | 2 +- cmd/uninstall_windows.go | 2 +- common/tlsutils.go | 2 +- dataprovider/bolt_disabled.go | 2 +- dataprovider/sqlite_disabled.go | 2 +- httpd/httpd_test.go | 8 +++---- httpdtest/httpfsimpl.go | 2 +- logger/logger.go | 3 ++- metric/metric_disabled.go | 38 ++++++++++++++++---------------- service/awscontainer_disabled.go | 2 +- sftpd/cmd_windows.go | 2 +- sftpd/httpfs_test.go | 4 ++-- sftpd/sftpd_test.go | 4 ++-- vfs/azblobfs_disabled.go | 2 +- vfs/gcsfs_disabled.go | 2 +- vfs/httpfs.go | 4 ++-- vfs/osfs.go | 2 +- vfs/s3fs_disabled.go | 2 +- vfs/sftpfs.go | 2 +- 34 files changed, 59 insertions(+), 58 deletions(-) diff --git a/cmd/acme.go b/cmd/acme.go index 104b7c27..4b580556 100644 --- a/cmd/acme.go +++ b/cmd/acme.go @@ -40,7 +40,7 @@ Certificates are saved in the configured "certs_path". After this initial step, the certificates are automatically checked and renewed by the SFTPGo service `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { logger.DisableLogger() logger.EnableConsoleLogger(zerolog.DebugLevel) configDir = util.CleanDirInput(configDir) diff --git a/cmd/awscontainer_disabled.go b/cmd/awscontainer_disabled.go index ebbd6ec0..f20e665b 100644 --- a/cmd/awscontainer_disabled.go +++ b/cmd/awscontainer_disabled.go @@ -21,4 +21,4 @@ import ( "github.com/spf13/cobra" ) -func addAWSContainerFlags(cmd *cobra.Command) {} +func addAWSContainerFlags(_ *cobra.Command) {} diff --git a/cmd/genman.go b/cmd/genman.go index b171c3ff..2e7b8063 100644 --- a/cmd/genman.go +++ b/cmd/genman.go @@ -38,7 +38,7 @@ command-line interface. By default, it creates the man page files in the "man" directory under the current directory. `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { logger.DisableLogger() logger.EnableConsoleLogger(zerolog.DebugLevel) if _, err := os.Stat(manDir); errors.Is(err, fs.ErrNotExist) { diff --git a/cmd/initprovider.go b/cmd/initprovider.go index 2984f631..b9cb3db5 100644 --- a/cmd/initprovider.go +++ b/cmd/initprovider.go @@ -49,7 +49,7 @@ To initialize/update the data provider from the configuration directory simply u $ sftpgo initprovider Please take a look at the usage below to customize the options.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { logger.DisableLogger() logger.EnableConsoleLogger(zerolog.DebugLevel) configDir = util.CleanDirInput(configDir) diff --git a/cmd/install_windows.go b/cmd/install_windows.go index 42f666f3..8f8aaba1 100644 --- a/cmd/install_windows.go +++ b/cmd/install_windows.go @@ -35,7 +35,7 @@ line flags simply use: sftpgo service install Please take a look at the usage below to customize the startup options`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { s := service.Service{ ConfigDir: util.CleanDirInput(configDir), ConfigFile: configFile, diff --git a/cmd/portable.go b/cmd/portable.go index 0697455c..80ad425a 100644 --- a/cmd/portable.go +++ b/cmd/portable.go @@ -106,7 +106,7 @@ use: $ sftpgo portable Please take a look at the usage below to customize the serving parameters`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { portableDir := directoryToServe fsProvider := sdk.GetProviderByName(portableFsProvider) if !filepath.IsAbs(portableDir) { diff --git a/cmd/reload_windows.go b/cmd/reload_windows.go index d2d9c9ba..355968c8 100644 --- a/cmd/reload_windows.go +++ b/cmd/reload_windows.go @@ -27,7 +27,7 @@ var ( reloadCmd = &cobra.Command{ Use: "reload", Short: "Reload the SFTPGo Windows Service sending a \"paramchange\" request", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { s := service.WindowsService{ Service: service.Service{ Shutdown: make(chan bool), diff --git a/cmd/resetprovider.go b/cmd/resetprovider.go index eb48e6c6..93660a42 100644 --- a/cmd/resetprovider.go +++ b/cmd/resetprovider.go @@ -39,7 +39,7 @@ configuration file and resets the provider by deleting all data and schemas. This command is not supported for the memory provider. Please take a look at the usage below to customize the options.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { logger.DisableLogger() logger.EnableConsoleLogger(zerolog.DebugLevel) configDir = util.CleanDirInput(configDir) diff --git a/cmd/revertprovider.go b/cmd/revertprovider.go index 758ffa03..34271557 100644 --- a/cmd/revertprovider.go +++ b/cmd/revertprovider.go @@ -37,7 +37,7 @@ configuration file and restore the provider schema and/or data to a previous ver This command is not supported for the memory provider. Please take a look at the usage below to customize the options.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { logger.DisableLogger() logger.EnableConsoleLogger(zerolog.DebugLevel) if revertProviderTargetVersion != 19 { diff --git a/cmd/rotatelogs_windows.go b/cmd/rotatelogs_windows.go index a3edc214..1d2926a0 100644 --- a/cmd/rotatelogs_windows.go +++ b/cmd/rotatelogs_windows.go @@ -27,7 +27,7 @@ var ( rotateLogCmd = &cobra.Command{ Use: "rotatelogs", Short: "Signal to the running service to rotate the logs", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { s := service.WindowsService{ Service: service.Service{ Shutdown: make(chan bool), diff --git a/cmd/serve.go b/cmd/serve.go index 4b3d2b7d..91fba0bc 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -33,7 +33,7 @@ use: $ sftpgo serve Please take a look at the usage below to customize the startup options`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { service := service.Service{ ConfigDir: util.CleanDirInput(configDir), ConfigFile: configFile, diff --git a/cmd/smtptest.go b/cmd/smtptest.go index 71d7df52..a5b13d9f 100644 --- a/cmd/smtptest.go +++ b/cmd/smtptest.go @@ -33,7 +33,7 @@ var ( Short: "Test the SMTP configuration", Long: `SFTPGo will try to send a test email to the specified recipient. If the SMTP configuration is correct you should receive this email.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { logger.DisableLogger() logger.EnableConsoleLogger(zerolog.DebugLevel) configDir = util.CleanDirInput(configDir) diff --git a/cmd/start_windows.go b/cmd/start_windows.go index 4c3bc463..a9b09466 100644 --- a/cmd/start_windows.go +++ b/cmd/start_windows.go @@ -29,7 +29,7 @@ var ( startCmd = &cobra.Command{ Use: "start", Short: "Start the SFTPGo Windows Service", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { configDir = util.CleanDirInput(configDir) if !filepath.IsAbs(logFilePath) && util.IsFileInputValid(logFilePath) { logFilePath = filepath.Join(configDir, logFilePath) diff --git a/cmd/startsubsys.go b/cmd/startsubsys.go index 80af00e6..ca41a335 100644 --- a/cmd/startsubsys.go +++ b/cmd/startsubsys.go @@ -51,7 +51,7 @@ Subsystem sftp sftpgo startsubsys Command-line flags should be specified in the Subsystem declaration. `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { logSender := "startsubsys" connectionID := xid.New().String() var zeroLogLevel zerolog.Level diff --git a/cmd/status_windows.go b/cmd/status_windows.go index 00ca3a86..cccc6ec5 100644 --- a/cmd/status_windows.go +++ b/cmd/status_windows.go @@ -27,7 +27,7 @@ var ( statusCmd = &cobra.Command{ Use: "status", Short: "Retrieve the status for the SFTPGo Windows Service", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { s := service.WindowsService{ Service: service.Service{ Shutdown: make(chan bool), diff --git a/cmd/stop_windows.go b/cmd/stop_windows.go index fcab2db5..dc811e74 100644 --- a/cmd/stop_windows.go +++ b/cmd/stop_windows.go @@ -27,7 +27,7 @@ var ( stopCmd = &cobra.Command{ Use: "stop", Short: "Stop the SFTPGo Windows Service", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { s := service.WindowsService{ Service: service.Service{ Shutdown: make(chan bool), diff --git a/cmd/uninstall_windows.go b/cmd/uninstall_windows.go index f57899b6..51b21bd5 100644 --- a/cmd/uninstall_windows.go +++ b/cmd/uninstall_windows.go @@ -27,7 +27,7 @@ var ( uninstallCmd = &cobra.Command{ Use: "uninstall", Short: "Uninstall the SFTPGo Windows Service", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { s := service.WindowsService{ Service: service.Service{ Shutdown: make(chan bool), diff --git a/common/tlsutils.go b/common/tlsutils.go index b5bc320b..18b731ff 100644 --- a/common/tlsutils.go +++ b/common/tlsutils.go @@ -97,7 +97,7 @@ func (m *CertManager) loadCertificates() error { // GetCertificateFunc returns the loaded certificate func (m *CertManager) GetCertificateFunc(certID string) func(*tls.ClientHelloInfo) (*tls.Certificate, error) { - return func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) { + return func(_ *tls.ClientHelloInfo) (*tls.Certificate, error) { m.RLock() defer m.RUnlock() diff --git a/dataprovider/bolt_disabled.go b/dataprovider/bolt_disabled.go index cfbc80d0..4a8f517f 100644 --- a/dataprovider/bolt_disabled.go +++ b/dataprovider/bolt_disabled.go @@ -27,6 +27,6 @@ func init() { version.AddFeature("-bolt") } -func initializeBoltProvider(basePath string) error { +func initializeBoltProvider(_ string) error { return errors.New("bolt disabled at build time") } diff --git a/dataprovider/sqlite_disabled.go b/dataprovider/sqlite_disabled.go index 9e78a09f..1e43cd2e 100644 --- a/dataprovider/sqlite_disabled.go +++ b/dataprovider/sqlite_disabled.go @@ -27,6 +27,6 @@ func init() { version.AddFeature("-sqlite") } -func initializeSQLiteProvider(basePath string) error { +func initializeSQLiteProvider(_ string) error { return errors.New("SQLite disabled at build time") } diff --git a/httpd/httpd_test.go b/httpd/httpd_test.go index abb9d044..bbe8ad7b 100644 --- a/httpd/httpd_test.go +++ b/httpd/httpd_test.go @@ -20284,13 +20284,13 @@ func TestSecondFactorRequirements(t *testing.T) { func startOIDCMockServer() { go func() { - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, "OK\n") }) - http.HandleFunc("/auth/realms/sftpgo/.well-known/openid-configuration", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/auth/realms/sftpgo/.well-known/openid-configuration", func(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, `{"issuer":"http://127.0.0.1:11111/auth/realms/sftpgo","authorization_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/auth","token_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/token","introspection_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/token/introspect","userinfo_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/userinfo","end_session_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/logout","frontchannel_logout_session_supported":true,"frontchannel_logout_supported":true,"jwks_uri":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/certs","check_session_iframe":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/login-status-iframe.html","grant_types_supported":["authorization_code","implicit","refresh_token","password","client_credentials","urn:ietf:params:oauth:grant-type:device_code","urn:openid:params:grant-type:ciba"],"response_types_supported":["code","none","id_token","token","id_token token","code id_token","code token","code id_token token"],"subject_types_supported":["public","pairwise"],"id_token_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"id_token_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"id_token_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"userinfo_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512","none"],"request_object_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512","none"],"request_object_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"request_object_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"response_modes_supported":["query","fragment","form_post","query.jwt","fragment.jwt","form_post.jwt","jwt"],"registration_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/clients-registrations/openid-connect","token_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"token_endpoint_auth_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"introspection_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"introspection_endpoint_auth_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"authorization_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"authorization_encryption_alg_values_supported":["RSA-OAEP","RSA-OAEP-256","RSA1_5"],"authorization_encryption_enc_values_supported":["A256GCM","A192GCM","A128GCM","A128CBC-HS256","A192CBC-HS384","A256CBC-HS512"],"claims_supported":["aud","sub","iss","auth_time","name","given_name","family_name","preferred_username","email","acr"],"claim_types_supported":["normal"],"claims_parameter_supported":true,"scopes_supported":["openid","phone","email","web-origins","offline_access","microprofile-jwt","profile","address","roles"],"request_parameter_supported":true,"request_uri_parameter_supported":true,"require_request_uri_registration":true,"code_challenge_methods_supported":["plain","S256"],"tls_client_certificate_bound_access_tokens":true,"revocation_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/revoke","revocation_endpoint_auth_methods_supported":["private_key_jwt","client_secret_basic","client_secret_post","tls_client_auth","client_secret_jwt"],"revocation_endpoint_auth_signing_alg_values_supported":["PS384","ES384","RS384","HS256","HS512","ES256","RS256","HS384","ES512","PS256","PS512","RS512"],"backchannel_logout_supported":true,"backchannel_logout_session_supported":true,"device_authorization_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/auth/device","backchannel_token_delivery_modes_supported":["poll","ping"],"backchannel_authentication_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/ext/ciba/auth","backchannel_authentication_request_signing_alg_values_supported":["PS384","ES384","RS384","ES256","RS256","ES512","PS256","PS512","RS512"],"require_pushed_authorization_requests":false,"pushed_authorization_request_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/ext/par/request","mtls_endpoint_aliases":{"token_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/token","revocation_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/revoke","introspection_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/token/introspect","device_authorization_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/auth/device","registration_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/clients-registrations/openid-connect","userinfo_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/userinfo","pushed_authorization_request_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/ext/par/request","backchannel_authentication_endpoint":"http://127.0.0.1:11111/auth/realms/sftpgo/protocol/openid-connect/ext/ciba/auth"}}`) }) - http.HandleFunc("/404", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/404", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, "Not found\n") }) @@ -20355,7 +20355,7 @@ func waitTCPListening(address string) { func startSMTPServer() { go func() { - if err := smtpd.ListenAndServe(smtpServerAddr, func(remoteAddr net.Addr, from string, to []string, data []byte) error { + if err := smtpd.ListenAndServe(smtpServerAddr, func(_ net.Addr, _ string, _ []string, data []byte) error { re := regexp.MustCompile(`code is ".*?"`) code := strings.TrimPrefix(string(re.Find(data)), "code is ") lastResetCode = strings.ReplaceAll(code, "\"", "") diff --git a/httpdtest/httpfsimpl.go b/httpdtest/httpfsimpl.go index 14f02a33..52dc6d7d 100644 --- a/httpdtest/httpfsimpl.go +++ b/httpdtest/httpfsimpl.go @@ -377,7 +377,7 @@ func (fs *httpFsImpl) dirsize(w http.ResponseWriter, r *http.Request) { numFiles := 0 size := int64(0) if info.IsDir() { - err = filepath.Walk(fsPath, func(path string, info os.FileInfo, err error) error { + err = filepath.Walk(fsPath, func(_ string, info os.FileInfo, err error) error { if err != nil { return err } diff --git a/logger/logger.go b/logger/logger.go index 6344e03a..0c8b5a21 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -227,6 +227,7 @@ func CommandLog(command, path, target, user, fileMode, connectionID, protocol st logger.Info(). Timestamp(). Str("sender", command). + Str("local_addr", localAddr). Str("remote_addr", remoteAddr). Str("username", user). Str("file_path", path). @@ -235,7 +236,7 @@ func CommandLog(command, path, target, user, fileMode, connectionID, protocol st Int("uid", uid). Int("gid", gid). Str("access_time", atime). - Str("modification_time", atime). + Str("modification_time", mtime). Int64("size", size). Str("ssh_command", sshCommand). Str("connection_id", connectionID). diff --git a/metric/metric_disabled.go b/metric/metric_disabled.go index f139e956..33f7862d 100644 --- a/metric/metric_disabled.go +++ b/metric/metric_disabled.go @@ -14,62 +14,62 @@ func init() { } // AddMetricsEndpoint exposes metrics to the specified endpoint -func AddMetricsEndpoint(metricsPath string, handler chi.Router) {} +func AddMetricsEndpoint(_ string, _ chi.Router) {} // TransferCompleted updates metrics after an upload or a download -func TransferCompleted(bytesSent, bytesReceived int64, transferKind int, err error, isSFTPFs bool) {} +func TransferCompleted(_, _ int64, _ int, _ error, _ bool) {} // S3TransferCompleted updates metrics after an S3 upload or a download -func S3TransferCompleted(bytes int64, transferKind int, err error) {} +func S3TransferCompleted(_ int64, _ int, _ error) {} // S3ListObjectsCompleted updates metrics after an S3 list objects request terminates -func S3ListObjectsCompleted(err error) {} +func S3ListObjectsCompleted(_ error) {} // S3CopyObjectCompleted updates metrics after an S3 copy object request terminates -func S3CopyObjectCompleted(err error) {} +func S3CopyObjectCompleted(_ error) {} // S3DeleteObjectCompleted updates metrics after an S3 delete object request terminates -func S3DeleteObjectCompleted(err error) {} +func S3DeleteObjectCompleted(_ error) {} // S3HeadBucketCompleted updates metrics after an S3 head bucket request terminates -func S3HeadBucketCompleted(err error) {} +func S3HeadBucketCompleted(_ error) {} // GCSTransferCompleted updates metrics after a GCS upload or a download -func GCSTransferCompleted(bytes int64, transferKind int, err error) {} +func GCSTransferCompleted(_ int64, _ int, _ error) {} // GCSListObjectsCompleted updates metrics after a GCS list objects request terminates -func GCSListObjectsCompleted(err error) {} +func GCSListObjectsCompleted(_ error) {} // GCSCopyObjectCompleted updates metrics after a GCS copy object request terminates -func GCSCopyObjectCompleted(err error) {} +func GCSCopyObjectCompleted(_ error) {} // GCSDeleteObjectCompleted updates metrics after a GCS delete object request terminates -func GCSDeleteObjectCompleted(err error) {} +func GCSDeleteObjectCompleted(_ error) {} // GCSHeadBucketCompleted updates metrics after a GCS head bucket request terminates -func GCSHeadBucketCompleted(err error) {} +func GCSHeadBucketCompleted(_ error) {} // HTTPFsTransferCompleted updates metrics after an HTTPFs upload or a download -func HTTPFsTransferCompleted(bytes int64, transferKind int, err error) {} +func HTTPFsTransferCompleted(_ int64, _ int, _ error) {} // SSHCommandCompleted update metrics after an SSH command terminates -func SSHCommandCompleted(err error) {} +func SSHCommandCompleted(_ error) {} // UpdateDataProviderAvailability updates the metric for the data provider availability -func UpdateDataProviderAvailability(err error) {} +func UpdateDataProviderAvailability(_ error) {} // AddLoginAttempt increments the metrics for login attempts -func AddLoginAttempt(authMethod string) {} +func AddLoginAttempt(_ string) {} // AddLoginResult increments the metrics for login results -func AddLoginResult(authMethod string, err error) {} +func AddLoginResult(_ string, _ error) {} // AddNoAuthTryed increments the metric for clients disconnected // for inactivity before trying to login func AddNoAuthTryed() {} // HTTPRequestServed increments the metrics for HTTP requests -func HTTPRequestServed(status int) {} +func HTTPRequestServed(_ int) {} // UpdateActiveConnectionsSize sets the metric for active connections -func UpdateActiveConnectionsSize(size int) {} +func UpdateActiveConnectionsSize(_ int) {} diff --git a/service/awscontainer_disabled.go b/service/awscontainer_disabled.go index d57d362a..f72b55d1 100644 --- a/service/awscontainer_disabled.go +++ b/service/awscontainer_disabled.go @@ -17,6 +17,6 @@ package service -func registerAWSContainer(disableAWSInstallationCode bool) error { +func registerAWSContainer(_ bool) error { return nil } diff --git a/sftpd/cmd_windows.go b/sftpd/cmd_windows.go index 9385d589..790cc76d 100644 --- a/sftpd/cmd_windows.go +++ b/sftpd/cmd_windows.go @@ -18,6 +18,6 @@ import ( "os/exec" ) -func wrapCmd(cmd *exec.Cmd, uid, gid int) *exec.Cmd { +func wrapCmd(cmd *exec.Cmd, _, _ int) *exec.Cmd { return cmd } diff --git a/sftpd/httpfs_test.go b/sftpd/httpfs_test.go index 5c41698b..a5cb015f 100644 --- a/sftpd/httpfs_test.go +++ b/sftpd/httpfs_test.go @@ -247,7 +247,7 @@ func TestHTTPFsWalk(t *testing.T) { assert.NoError(t, err) var walkedPaths []string - err = httpFs.Walk("/", func(walkedPath string, info fs.FileInfo, err error) error { + err = httpFs.Walk("/", func(walkedPath string, _ fs.FileInfo, err error) error { if err != nil { return err } @@ -269,7 +269,7 @@ func TestHTTPFsWalk(t *testing.T) { } } walkedPaths = nil - err = httpFs.Walk("/", func(walkedPath string, info fs.FileInfo, err error) error { + err = httpFs.Walk("/", func(walkedPath string, _ fs.FileInfo, err error) error { if err != nil { return err } diff --git a/sftpd/sftpd_test.go b/sftpd/sftpd_test.go index f01d6fa9..ea46d1aa 100644 --- a/sftpd/sftpd_test.go +++ b/sftpd/sftpd_test.go @@ -2719,7 +2719,7 @@ func TestInteractiveLoginWithPasscode(t *testing.T) { passwordAsked := false passcodeAsked := false authMethods := []ssh.AuthMethod{ - ssh.KeyboardInteractive(func(user, instruction string, questions []string, echos []bool) ([]string, error) { + ssh.KeyboardInteractive(func(_, _ string, questions []string, _ []bool) ([]string, error) { var answers []string if strings.HasPrefix(questions[0], "Password") { answers = append(answers, defaultPassword) @@ -2768,7 +2768,7 @@ func TestInteractiveLoginWithPasscode(t *testing.T) { _, _, err = getCustomAuthSftpClient(user, authMethods, "") assert.Error(t, err) authMethods = []ssh.AuthMethod{ - ssh.KeyboardInteractive(func(user, instruction string, questions []string, echos []bool) ([]string, error) { + ssh.KeyboardInteractive(func(_, _ string, questions []string, _ []bool) ([]string, error) { var answers []string if strings.HasPrefix(questions[0], "Password") { answers = append(answers, defaultPassword) diff --git a/vfs/azblobfs_disabled.go b/vfs/azblobfs_disabled.go index cb7675b4..d3e6d312 100644 --- a/vfs/azblobfs_disabled.go +++ b/vfs/azblobfs_disabled.go @@ -28,6 +28,6 @@ func init() { } // NewAzBlobFs returns an error, Azure Blob storage is disabled -func NewAzBlobFs(connectionID, localTempDir, mountPath string, config AzBlobFsConfig) (Fs, error) { +func NewAzBlobFs(_, _, _ string, _ AzBlobFsConfig) (Fs, error) { return nil, errors.New("Azure Blob Storage disabled at build time") } diff --git a/vfs/gcsfs_disabled.go b/vfs/gcsfs_disabled.go index e67650f5..d452765a 100644 --- a/vfs/gcsfs_disabled.go +++ b/vfs/gcsfs_disabled.go @@ -28,6 +28,6 @@ func init() { } // NewGCSFs returns an error, GCS is disabled -func NewGCSFs(connectionID, localTempDir, mountPath string, config GCSFsConfig) (Fs, error) { +func NewGCSFs(_, _, _ string, _ GCSFsConfig) (Fs, error) { return nil, errors.New("Google Cloud Storage disabled at build time") } diff --git a/vfs/httpfs.go b/vfs/httpfs.go index 0b3a6251..a1603abe 100644 --- a/vfs/httpfs.go +++ b/vfs/httpfs.go @@ -216,7 +216,7 @@ func NewHTTPFs(connectionID, localTempDir, mountPath string, config HTTPFsConfig return nil, fmt.Errorf("httpfs: invalid unix domain socket path: %q", socketPath) } if endpointURL.Scheme == "https" { - transport.DialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) { + transport.DialTLSContext = func(ctx context.Context, _, _ string) (net.Conn, error) { var tlsConfig *tls.Config var d tls.Dialer if config.SkipTLSVerify { @@ -226,7 +226,7 @@ func NewHTTPFs(connectionID, localTempDir, mountPath string, config HTTPFsConfig return d.DialContext(ctx, "unix", socketPath) } } else { - transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { + transport.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { var d net.Dialer return d.DialContext(ctx, "unix", socketPath) } diff --git a/vfs/osfs.go b/vfs/osfs.go index 00b9f0a4..12100c12 100644 --- a/vfs/osfs.go +++ b/vfs/osfs.go @@ -372,7 +372,7 @@ func (fs *OsFs) GetDirSize(dirname string) (int, int64, error) { size := int64(0) isDir, err := IsDirectory(fs, dirname) if err == nil && isDir { - err = filepath.Walk(dirname, func(path string, info os.FileInfo, err error) error { + err = filepath.Walk(dirname, func(_ string, info os.FileInfo, err error) error { if err != nil { return err } diff --git a/vfs/s3fs_disabled.go b/vfs/s3fs_disabled.go index b863e362..24fcc1c3 100644 --- a/vfs/s3fs_disabled.go +++ b/vfs/s3fs_disabled.go @@ -28,6 +28,6 @@ func init() { } // NewS3Fs returns an error, S3 is disabled -func NewS3Fs(connectionID, localTempDir, mountPath string, config S3FsConfig) (Fs, error) { +func NewS3Fs(_, _, _ string, _ S3FsConfig) (Fs, error) { return nil, errors.New("S3 disabled at build time") } diff --git a/vfs/sftpfs.go b/vfs/sftpfs.go index 717a99ad..67d3e378 100644 --- a/vfs/sftpfs.go +++ b/vfs/sftpfs.go @@ -827,7 +827,7 @@ func (fs *SFTPFs) createConnection() error { var err error clientConfig := &ssh.ClientConfig{ User: fs.config.Username, - HostKeyCallback: func(hostname string, remote net.Addr, key ssh.PublicKey) error { + HostKeyCallback: func(_ string, _ net.Addr, key ssh.PublicKey) error { fp := ssh.FingerprintSHA256(key) if util.Contains(sftpFingerprints, fp) { if util.Contains(fs.config.forbiddenSelfUsernames, fs.config.Username) {