Fix fmt
Some checks failed
checks / check and test (pull_request) Failing after 24s

This commit is contained in:
2025-08-23 21:39:29 -07:00
parent e64b6ef638
commit 6fe7cebc70

View File

@@ -5,7 +5,6 @@ SHASUM ?= shasum -a 256
export PATH := $($(GO) env GOPATH)/bin:$(PATH)
GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
GOFMT ?= gofmt -s
SERVER_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
SERVER_VERSION_TAG ?= $(shell sed 's/+/_/' <<< $(SERVER_VERSION))
@@ -20,7 +19,7 @@ SOURCES ?= $(shell find . -name "*.go" -type f)
.PHONY: fmt
fmt:
$(GOFMT) -w $(GOFILES)
go fmt ./...
.PHONY: lint
lint: install-lint-tools
@@ -37,7 +36,7 @@ misspell: install-lint-tools
.PHONY: fmt-check
fmt-check:
# get all go files and run go fmt on them
@diff=$$($(GOFMT) -d $(GOFILES)); \
@diff=$$(go fmt ./...); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \
echo "$${diff}"; \

14
cmd.go
View File

@@ -1548,14 +1548,14 @@ func (cmd commandSyst) Execute(sess *Session, param string) {
// commandType responds to the TYPE FTP command.
//
// like the MODE and STRU commands, TYPE dates back to a time when the FTP
// protocol was more aware of the content of the files it was transferring, and
// would sometimes be expected to translate things like EOL markers on the fly.
//like the MODE and STRU commands, TYPE dates back to a time when the FTP
//protocol was more aware of the content of the files it was transferring, and
//would sometimes be expected to translate things like EOL markers on the fly.
//
// Valid options were A(SCII), I(mage), E(BCDIC) or LN (for local type). Since
// we plan to just accept bytes from the client unchanged, I think Image mode is
// adequate. The RFC requires we accept ASCII mode however, so accept it, but
// ignore it.
//Valid options were A(SCII), I(mage), E(BCDIC) or LN (for local type). Since
//we plan to just accept bytes from the client unchanged, I think Image mode is
//adequate. The RFC requires we accept ASCII mode however, so accept it, but
//ignore it.
type commandType struct{}
func (cmd commandType) IsExtend() bool {

View File

@@ -40,12 +40,12 @@ type DataSocket interface {
}
type activeSocket struct {
conn *net.TCPConn
conn *net.TCPConn
reader io.Reader
writer io.Writer
sess *Session
host string
port int
sess *Session
host string
port int
}
func newActiveSocket(sess *Session, remote string, port int) (DataSocket, error) {
@@ -105,8 +105,8 @@ func (socket *activeSocket) Close() error {
type passiveSocket struct {
sess *Session
conn net.Conn
reader io.Reader
writer io.Writer
reader io.Reader
writer io.Writer
port int
host string
ingress chan []byte

View File

@@ -34,7 +34,7 @@ func (formatter listFormatter) Detailed() []byte {
fmt.Fprint(&buf, lpad(strconv.FormatInt(file.Size(), 10), 12))
if file.ModTime().Before(time.Now().AddDate(-1, 0, 0)) {
fmt.Fprint(&buf, file.ModTime().Format(" Jan _2 2006 "))
} else{
} else {
fmt.Fprint(&buf, file.ModTime().Format(" Jan _2 15:04 "))
}
fmt.Fprintf(&buf, "%s\r\n", file.Name())

View File

@@ -161,16 +161,15 @@ func optsWithDefaults(opts *Options) *Options {
// via an instance of Options. Calling this function in your code will
// probably look something like this:
//
// driver := &MyDriver{}
// opts := &server.Options{
// Driver: driver,
// Auth: auth,
// Port: 2000,
// Perm: perm,
// Hostname: "127.0.0.1",
// }
// server, err := server.NewServer(opts)
//
//driver := &MyDriver{}
//opts := &server.Options{
// Driver: driver,
// Auth: auth,
// Port: 2000,
// Perm: perm,
// Hostname: "127.0.0.1",
//}
//server, err := server.NewServer(opts)
func NewServer(opts *Options) (*Server, error) {
opts = optsWithDefaults(opts)
if opts.Perm == nil {
@@ -250,7 +249,6 @@ func simpleTLSConfig(certFile, keyFile string) (*tls.Config, error) {
// If the server fails to start for any reason, an error will be returned. Common
// errors are trying to bind to a privileged port or something else is already
// listening on the same port.
//
func (server *Server) ListenAndServe() error {
var listener net.Listener
var err error
@@ -280,7 +278,6 @@ func (server *Server) ListenAndServe() error {
// Serve accepts connections on a given net.Listener and handles each
// request in a new goroutine.
//
func (server *Server) Serve(l net.Listener) error {
server.listener = l
server.ctx, server.cancel = context.WithCancel(context.Background())