Run go fmt
It has some Opinions on my code. Mostly whitespace and organizing the ordering of my structs.main
parent
bbdc5325ae
commit
cc4913d573
44
main.go
44
main.go
|
@ -18,42 +18,42 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/url"
|
||||
"net/http"
|
||||
"time"
|
||||
"context"
|
||||
"html/template"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"path"
|
||||
"os"
|
||||
"mime/multipart"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"fmt"
|
||||
"flag"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/mdp/qrterminal"
|
||||
)
|
||||
|
||||
// Config stores all settings for an instance of RUFF.
|
||||
type Config struct {
|
||||
Downloads int
|
||||
Port int
|
||||
FilePath string
|
||||
FileName string
|
||||
HideQR bool
|
||||
Port int
|
||||
FilePath string
|
||||
FileName string
|
||||
HideQR bool
|
||||
Uploading bool
|
||||
Multiple bool
|
||||
Multiple bool
|
||||
}
|
||||
|
||||
func getConfig() (Config, error) {
|
||||
conf := Config{
|
||||
Downloads: 1,
|
||||
Port: 8008,
|
||||
HideQR: false,
|
||||
Port: 8008,
|
||||
HideQR: false,
|
||||
Uploading: false,
|
||||
Multiple: true,
|
||||
Multiple: true,
|
||||
}
|
||||
|
||||
flag.IntVar(&conf.Downloads, "count", conf.Downloads, "number of downloads before exiting. set to -1 for unlimited downloads.")
|
||||
|
@ -103,9 +103,9 @@ func main() {
|
|||
}
|
||||
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf(":%v", conf.Port),
|
||||
ReadTimeout: 10*time.Second,
|
||||
WriteTimeout: 10*time.Second,
|
||||
Addr: fmt.Sprintf(":%v", conf.Port),
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
}
|
||||
|
||||
if conf.Uploading {
|
||||
|
@ -137,8 +137,8 @@ func main() {
|
|||
|
||||
// Wait for the server to finish any transfers, up to 3 seconds
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(3*time.Second):
|
||||
case <-done:
|
||||
case <-time.After(3 * time.Second):
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue