fixed the code style with goimports

This commit is contained in:
Mebus
2018-01-23 13:56:26 +01:00
committed by Zlatko Čalušić
parent 6c846f856c
commit 75578acd66
4 changed files with 25 additions and 25 deletions
+3 -2
View File
@@ -2,14 +2,15 @@ package main
import ( import (
"errors" "errors"
restserver "github.com/restic/rest-server"
"github.com/spf13/cobra"
"log" "log"
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"runtime/pprof" "runtime/pprof"
restserver "github.com/restic/rest-server"
"github.com/spf13/cobra"
) )
// cmdRoot is the base command when no other command has been specified. // cmdRoot is the base command when no other command has been specified.
+2 -1
View File
@@ -1,8 +1,9 @@
package main package main
import ( import (
restserver "github.com/restic/rest-server"
"testing" "testing"
restserver "github.com/restic/rest-server"
) )
func TestTLSSettings(t *testing.T) { func TestTLSSettings(t *testing.T) {
+10 -12
View File
@@ -142,7 +142,7 @@ func CheckConfig(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -172,7 +172,7 @@ func GetConfig(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -202,7 +202,7 @@ func SaveConfig(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -238,7 +238,7 @@ func DeleteConfig(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -275,7 +275,7 @@ func ListBlobs(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -336,7 +336,7 @@ func CheckBlob(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -366,7 +366,7 @@ func GetBlob(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -408,7 +408,7 @@ func SaveBlob(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
@@ -483,12 +483,11 @@ func DeleteBlob(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
if Config.AppendOnly && pat.Param(r, "type") != "locks" { if Config.AppendOnly && pat.Param(r, "type") != "locks" {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
@@ -534,12 +533,11 @@ func CreateRepo(w http.ResponseWriter, r *http.Request) {
} }
// private repos // private repos
if (Config.PrivateRepos && (getUser(r) != getRepo(r))) { if Config.PrivateRepos && (getUser(r) != getRepo(r)) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return return
} }
repo, err := join(Config.Path, getRepo(r)) repo, err := join(Config.Path, getRepo(r))
if err != nil { if err != nil {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
+1 -1
View File
@@ -18,9 +18,9 @@ var Config = struct {
Listen string Listen string
Log string Log string
CPUProfile string CPUProfile string
TLS bool
TLSKey string TLSKey string
TLSCert string TLSCert string
TLS bool
AppendOnly bool AppendOnly bool
PrivateRepos bool PrivateRepos bool
Prometheus bool Prometheus bool