Fixes fmt & typos (#18)
This commit is contained in:
Родитель
e95390c6a6
Коммит
95683c278e
|
@ -11,10 +11,10 @@ import (
|
|||
|
||||
const (
|
||||
// DefaultURL defines the standard remote URL.
|
||||
DefaultURL = "https://github.com"
|
||||
DefaultURL = "https://github.com"
|
||||
|
||||
// DefaultAPI defines the standard API URL
|
||||
DefaultAPI = "https://api.github.com/"
|
||||
DefaultAPI = "https://api.github.com/"
|
||||
|
||||
// DefaultScope defines the standard scope for the remote.
|
||||
DefaultScope = "user:email,read:org,public_repo"
|
||||
|
|
|
@ -64,7 +64,7 @@ func ParseRequest(r *http.Request, fn SecretFunc) (*Token, error) {
|
|||
return Parse(token, fn)
|
||||
}
|
||||
|
||||
// and finally we attemt to get the token from
|
||||
// and finally we attempt to get the token from
|
||||
// the user session cookie
|
||||
cookie, err := r.Cookie("user_sess")
|
||||
if err != nil {
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/go-gitea/lgtm/store"
|
||||
"github.com/go-gitea/lgtm/store/migration"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/rubenv/sql-migrate"
|
||||
"github.com/russross/meddler"
|
||||
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
package datastore
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strconv"
|
||||
|
||||
"github.com/russross/meddler"
|
||||
"github.com/russross/meddler"
|
||||
)
|
||||
|
||||
// rebind is a helper function that changes the sql
|
||||
// bind type from ? to $ for postgres queries.
|
||||
func rebind(query string) string {
|
||||
if meddler.Default != meddler.PostgreSQL {
|
||||
return query
|
||||
}
|
||||
if meddler.Default != meddler.PostgreSQL {
|
||||
return query
|
||||
}
|
||||
|
||||
qb := []byte(query)
|
||||
rqb := make([]byte, 0, len(qb)+5)
|
||||
j := 1
|
||||
qb := []byte(query)
|
||||
rqb := make([]byte, 0, len(qb)+5)
|
||||
j := 1
|
||||
|
||||
for _, b := range qb {
|
||||
switch b {
|
||||
case '?':
|
||||
rqb = append(rqb, '$')
|
||||
for _, b := range strconv.Itoa(j) {
|
||||
rqb = append(rqb, byte(b))
|
||||
}
|
||||
j++
|
||||
case '`':
|
||||
rqb = append(rqb, ' ')
|
||||
default:
|
||||
rqb = append(rqb, b)
|
||||
}
|
||||
}
|
||||
for _, b := range qb {
|
||||
switch b {
|
||||
case '?':
|
||||
rqb = append(rqb, '$')
|
||||
for _, b := range strconv.Itoa(j) {
|
||||
rqb = append(rqb, byte(b))
|
||||
}
|
||||
j++
|
||||
case '`':
|
||||
rqb = append(rqb, ' ')
|
||||
default:
|
||||
rqb = append(rqb, b)
|
||||
}
|
||||
}
|
||||
|
||||
return string(rqb)
|
||||
return string(rqb)
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ func Template() *template.Template {
|
|||
}
|
||||
|
||||
// marshal is a helper function to render data as JSON
|
||||
// inside the tempalte.
|
||||
// inside the template.
|
||||
func marshal(v interface{}) template.JS {
|
||||
a, _ := json.Marshal(v)
|
||||
return template.JS(a)
|
||||
|
|
Загрузка…
Ссылка в новой задаче