We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b08ad80 commit cd20a38Copy full SHA for cd20a38
lib/api.go
@@ -4,8 +4,8 @@ import (
4
"encoding/json"
5
"fmt"
6
"io"
7
- "io/ioutil"
8
"net/http"
+ "os"
9
)
10
11
const apiURL = "https://api.godoc.org/search?q="
@@ -20,7 +20,6 @@ type Package struct {
20
Score float64 `json:"score,omitempty"`
21
}
22
23
-
24
type Response struct {
25
Results []Package `json:"results"`
26
@@ -34,7 +33,7 @@ func doSearch(pkg string) ([]Package, error) {
34
33
defer resp.Body.Close()
35
36
if resp.StatusCode != http.StatusOK {
37
- io.Copy(ioutil.Discard, resp.Body)
+ io.Copy(os.Stderr, resp.Body)
38
return nil, fmt.Errorf("failed to search package, server return code=%s", resp.Status)
39
40
var res Response
0 commit comments