File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1
1
package bitbucket
2
2
3
3
import (
4
- "encoding/json "
4
+ "errors "
5
5
6
6
"github.com/mitchellh/mapstructure"
7
7
)
@@ -61,17 +61,16 @@ func (r *Repositories) ListPublic() (interface{}, error) {
61
61
}
62
62
63
63
func decodeRepositorys (reposResponse interface {}) (* RepositoriesRes , error ) {
64
- var reposResponseMap map [string ]interface {}
65
- err := json .Unmarshal (reposResponse .([]byte ), & reposResponseMap )
66
- if err != nil {
67
- return nil , err
64
+ reposResponseMap , ok := reposResponse .(map [string ]interface {})
65
+ if ! ok {
66
+ return nil , errors .New ("Not a valid format" )
68
67
}
69
68
70
69
repoArray := reposResponseMap ["values" ].([]interface {})
71
70
var repos []Repository
72
71
for _ , repoEntry := range repoArray {
73
72
var repo Repository
74
- err = mapstructure .Decode (repoEntry , & repo )
73
+ err : = mapstructure .Decode (repoEntry , & repo )
75
74
if err == nil {
76
75
repos = append (repos , repo )
77
76
}
You can’t perform that action at this time.
0 commit comments