kill perf

This commit is contained in:
Richard Patel
2018-11-06 01:44:09 +01:00
parent ed5e35f005
commit 8cfada7904
7 changed files with 339 additions and 326 deletions

14
main.go
View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/sirupsen/logrus"
"github.com/terorie/oddb-go/fasturl"
"github.com/terorie/oddb-go/runes"
"github.com/urfave/cli"
"log"
"net/http"
@@ -50,15 +51,18 @@ func cmdCrawler(clic *cli.Context) error {
args := clic.Args()
remotes := make([]*OD, len(args))
for i, arg := range args {
for i, argStr := range args {
// https://github.com/golang/go/issues/19779
if !strings.Contains(arg, "://") {
arg = "http://" + arg
if !strings.Contains(argStr, "://") {
argStr = "http://" + argStr
}
arg := []rune(argStr)
var u fasturl.URL
err := u.Parse(arg)
if !strings.HasSuffix(u.Path, "/") {
u.Path += "/"
if !runes.HasSuffix(u.Path, []rune("/")) {
u.Path = append(u.Path, '/')
}
if err != nil { return err }
remotes[i] = &OD{ BaseUri: u }