]> Cypherpunks.ru repositories - gocheese.git/blobdiff - gocheese.go
Unnecessary else
[gocheese.git] / gocheese.go
index 9b74ee7d5cf729b6f6f0faf09fb108b26ca896bc..7a36129746ab96d1254564d69385323639531d1d 100644 (file)
@@ -66,6 +66,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 )
 
 var (
+       pkgPyPI        = regexp.MustCompile(`^.*<a href="([^"]+)"[^>]*>(.+)</a><br/>.*$`)
+       Version string = "UNKNOWN"
+
        root             = flag.String("root", "./packages", "Path to packages directory")
        bind             = flag.String("bind", "[::]:8080", "Address to bind to")
        tlsCert          = flag.String("tls-cert", "", "Path to TLS X.509 certificate")
@@ -79,17 +82,8 @@ var (
        maxClients       = flag.Int("maxclients", 128, "Maximal amount of simultaneous clients")
        version          = flag.Bool("version", false, "Print version information")
        warranty         = flag.Bool("warranty", false, "Print warranty information")
-
-       pkgPyPI        = regexp.MustCompile(`^.*<a href="([^"]+)"[^>]*>(.+)</a><br/>.*$`)
-       Version string = "UNKNOWN"
-
-       passwords map[string]Auther = make(map[string]Auther)
 )
 
-type Auther interface {
-       Auth(password string) bool
-}
-
 func mkdirForPkg(w http.ResponseWriter, r *http.Request, dir string) bool {
        path := filepath.Join(*root, dir)
        if _, err := os.Stat(path); os.IsNotExist(err) {
@@ -189,11 +183,10 @@ func refreshDir(w http.ResponseWriter, r *http.Request, dir, filenameGet string)
                _, err = os.Stat(path)
                if err == nil {
                        continue
-               } else {
-                       if !os.IsNotExist(err) {
-                               http.Error(w, err.Error(), http.StatusInternalServerError)
-                               return false
-                       }
+               }
+               if !os.IsNotExist(err) {
+                       http.Error(w, err.Error(), http.StatusInternalServerError)
+                       return false
                }
                log.Println(r.RemoteAddr, "pypi touch", filename)
                if err = ioutil.WriteFile(path, digest, os.FileMode(0666)); err != nil {