build: reformat comments to pass go1.19 vet
See: https://go.dev/doc/go1.19#go-doc
This commit is contained in:
+10
-10
@@ -19,16 +19,16 @@ import (
|
||||
// applyOptions configures volume from request options.
|
||||
//
|
||||
// There are 5 special options:
|
||||
// - "remote" aka "fs" determines existing remote from config file
|
||||
// with a path or on-the-fly remote using the ":backend:" syntax.
|
||||
// It is usually named "remote" in documentation but can be aliased as
|
||||
// "fs" to avoid confusion with the "remote" option of some backends.
|
||||
// - "type" is equivalent to the ":backend:" syntax (optional).
|
||||
// - "path" provides explicit on-remote path for "type" (optional).
|
||||
// - "mount-type" can be "mount", "cmount" or "mount2", defaults to
|
||||
// first found (optional).
|
||||
// - "persist" is reserved for future to create remotes persisted
|
||||
// in rclone.conf similar to rcd (optional).
|
||||
// - "remote" aka "fs" determines existing remote from config file
|
||||
// with a path or on-the-fly remote using the ":backend:" syntax.
|
||||
// It is usually named "remote" in documentation but can be aliased as
|
||||
// "fs" to avoid confusion with the "remote" option of some backends.
|
||||
// - "type" is equivalent to the ":backend:" syntax (optional).
|
||||
// - "path" provides explicit on-remote path for "type" (optional).
|
||||
// - "mount-type" can be "mount", "cmount" or "mount2", defaults to
|
||||
// first found (optional).
|
||||
// - "persist" is reserved for future to create remotes persisted
|
||||
// in rclone.conf similar to rcd (optional).
|
||||
//
|
||||
// Unlike rcd we use the flat naming scheme for mount, vfs and backend
|
||||
// options without substructures. Dashes, underscores and mixed case
|
||||
|
||||
+20
-19
@@ -185,26 +185,27 @@ func (s *server) serve() error {
|
||||
}
|
||||
|
||||
// close stops the ftp server
|
||||
//
|
||||
//lint:ignore U1000 unused when not building linux
|
||||
func (s *server) close() error {
|
||||
fs.Logf(s.f, "Stopping FTP on %s", s.srv.Hostname+":"+strconv.Itoa(s.srv.Port))
|
||||
return s.srv.Shutdown()
|
||||
}
|
||||
|
||||
//Logger ftp logger output formatted message
|
||||
// Logger ftp logger output formatted message
|
||||
type Logger struct{}
|
||||
|
||||
//Print log simple text message
|
||||
// Print log simple text message
|
||||
func (l *Logger) Print(sessionID string, message interface{}) {
|
||||
fs.Infof(sessionID, "%s", message)
|
||||
}
|
||||
|
||||
//Printf log formatted text message
|
||||
// Printf log formatted text message
|
||||
func (l *Logger) Printf(sessionID string, format string, v ...interface{}) {
|
||||
fs.Infof(sessionID, format, v...)
|
||||
}
|
||||
|
||||
//PrintCommand log formatted command execution
|
||||
// PrintCommand log formatted command execution
|
||||
func (l *Logger) PrintCommand(sessionID string, command string, params string) {
|
||||
if command == "PASS" {
|
||||
fs.Infof(sessionID, "> PASS ****")
|
||||
@@ -213,7 +214,7 @@ func (l *Logger) PrintCommand(sessionID string, command string, params string) {
|
||||
}
|
||||
}
|
||||
|
||||
//PrintResponse log responses
|
||||
// PrintResponse log responses
|
||||
func (l *Logger) PrintResponse(sessionID string, code int, message string) {
|
||||
fs.Infof(sessionID, "< %d %s", code, message)
|
||||
}
|
||||
@@ -237,7 +238,7 @@ func (s *server) NewDriver() (ftp.Driver, error) {
|
||||
return d, nil
|
||||
}
|
||||
|
||||
//Driver implementation of ftp server
|
||||
// Driver implementation of ftp server
|
||||
type Driver struct {
|
||||
s *server
|
||||
vfs *vfs.VFS
|
||||
@@ -265,7 +266,7 @@ func (d *Driver) CheckPasswd(user, pass string) (ok bool, err error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
//Stat get information on file or folder
|
||||
// Stat get information on file or folder
|
||||
func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error) {
|
||||
defer log.Trace(path, "")("fi=%+v, err = %v", &fi, &err)
|
||||
n, err := d.vfs.Stat(path)
|
||||
@@ -275,7 +276,7 @@ func (d *Driver) Stat(path string) (fi ftp.FileInfo, err error) {
|
||||
return &FileInfo{n, n.Mode(), d.vfs.Opt.UID, d.vfs.Opt.GID}, err
|
||||
}
|
||||
|
||||
//ChangeDir move current folder
|
||||
// ChangeDir move current folder
|
||||
func (d *Driver) ChangeDir(path string) (err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -290,7 +291,7 @@ func (d *Driver) ChangeDir(path string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
//ListDir list content of a folder
|
||||
// ListDir list content of a folder
|
||||
func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -326,7 +327,7 @@ func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err er
|
||||
return nil
|
||||
}
|
||||
|
||||
//DeleteDir delete a folder and his content
|
||||
// DeleteDir delete a folder and his content
|
||||
func (d *Driver) DeleteDir(path string) (err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -345,7 +346,7 @@ func (d *Driver) DeleteDir(path string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
//DeleteFile delete a file
|
||||
// DeleteFile delete a file
|
||||
func (d *Driver) DeleteFile(path string) (err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -364,7 +365,7 @@ func (d *Driver) DeleteFile(path string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
//Rename rename a file or folder
|
||||
// Rename rename a file or folder
|
||||
func (d *Driver) Rename(oldName, newName string) (err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -372,7 +373,7 @@ func (d *Driver) Rename(oldName, newName string) (err error) {
|
||||
return d.vfs.Rename(oldName, newName)
|
||||
}
|
||||
|
||||
//MakeDir create a folder
|
||||
// MakeDir create a folder
|
||||
func (d *Driver) MakeDir(path string) (err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -385,7 +386,7 @@ func (d *Driver) MakeDir(path string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
//GetFile download a file
|
||||
// GetFile download a file
|
||||
func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadCloser, err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -417,7 +418,7 @@ func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadClose
|
||||
return node.Size(), handle, nil
|
||||
}
|
||||
|
||||
//PutFile upload a file
|
||||
// PutFile upload a file
|
||||
func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64, err error) {
|
||||
d.lock.Lock()
|
||||
defer d.lock.Unlock()
|
||||
@@ -479,7 +480,7 @@ func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64,
|
||||
return bytes, nil
|
||||
}
|
||||
|
||||
//FileInfo struct to hold file info for ftp server
|
||||
// FileInfo struct to hold file info for ftp server
|
||||
type FileInfo struct {
|
||||
os.FileInfo
|
||||
|
||||
@@ -488,12 +489,12 @@ type FileInfo struct {
|
||||
group uint32
|
||||
}
|
||||
|
||||
//Mode return mode of file.
|
||||
// Mode return mode of file.
|
||||
func (f *FileInfo) Mode() os.FileMode {
|
||||
return f.mode
|
||||
}
|
||||
|
||||
//Owner return owner of file. Try to find the username if possible
|
||||
// Owner return owner of file. Try to find the username if possible
|
||||
func (f *FileInfo) Owner() string {
|
||||
str := fmt.Sprint(f.owner)
|
||||
u, err := user.LookupId(str)
|
||||
@@ -503,7 +504,7 @@ func (f *FileInfo) Owner() string {
|
||||
return u.Username
|
||||
}
|
||||
|
||||
//Group return group of file. Try to find the group name if possible
|
||||
// Group return group of file. Try to find the group name if possible
|
||||
func (f *FileInfo) Group() string {
|
||||
str := fmt.Sprint(f.group)
|
||||
g, err := user.LookupGroupId(str)
|
||||
|
||||
Reference in New Issue
Block a user