MCPcopy Create free account
hub / github.com/ardanlabs/practical-go / parseResponse

Function parseResponse

github/github.go:68–79  ·  view source on GitHub ↗
(r io.Reader)

Source from the content-addressed store, hash-verified

66}
67
68func parseResponse(r io.Reader) (string, int, error) {
69 var reply struct {
70 Name string
71 NumRepos int `json:"public_repos"`
72 }
73 dec := json.NewDecoder(r)
74 if err := dec.Decode(&reply); err != nil {
75 return "", 0, err
76 }
77
78 return reply.Name, reply.NumRepos, nil
79}
80
81/* JSON <-> Go
82

Callers 1

UserInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected