change json lib

This commit is contained in:
Jay 2019-03-27 13:32:24 +00:00
parent a3b44ba5d9
commit b98aab2d0d
3 changed files with 5 additions and 3 deletions

2
go.mod
View File

@ -13,7 +13,7 @@ require (
github.com/go-irc/irc v2.1.0+incompatible
github.com/gorilla/sessions v1.1.3 // indirect
github.com/jmoiron/sqlx v1.2.0
github.com/json-iterator/go v1.1.5 // indirect
github.com/json-iterator/go v1.1.6
github.com/lib/pq v1.0.0
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect

2
go.sum
View File

@ -37,6 +37,8 @@ github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=

View File

@ -1,7 +1,6 @@
package google
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
@ -10,11 +9,13 @@ import (
"strings"
"git.trj.tw/golang/mtfosbot/module/apis"
jsoniter "github.com/json-iterator/go"
"git.trj.tw/golang/mtfosbot/module/config"
)
var baseURL = "https://www.googleapis.com"
var json = jsoniter.ConfigCompatibleWithStandardLibrary
func getURL(p string, querystring ...interface{}) (string, bool) {
u, err := url.Parse(baseURL)
@ -94,7 +95,6 @@ func QueryYoutubeName(id string) (n string, err error) {
}
bodyBytes, err := ioutil.ReadAll(resp.Body)
fmt.Println("show yt resp body :: ", string(bodyBytes))
if err != nil {
return "", err
}