88 "flag"
99 "fmt"
1010 "io"
11- "io/ioutil"
1211 "log"
1312 "math/rand"
1413 "net/http"
@@ -130,7 +129,7 @@ func (p *PostPublisher) Publish(addr string, msg []byte) error {
130129 if err != nil {
131130 return err
132131 }
133- io .Copy (ioutil .Discard , resp .Body )
132+ io .Copy (io .Discard , resp .Body )
134133 resp .Body .Close ()
135134
136135 if resp .StatusCode < 200 || resp .StatusCode >= 300 {
@@ -147,7 +146,7 @@ func (p *GetPublisher) Publish(addr string, msg []byte) error {
147146 if err != nil {
148147 return err
149148 }
150- io .Copy (ioutil .Discard , resp .Body )
149+ io .Copy (io .Discard , resp .Body )
151150 resp .Body .Close ()
152151
153152 if resp .StatusCode != 200 {
@@ -156,16 +155,6 @@ func (p *GetPublisher) Publish(addr string, msg []byte) error {
156155 return nil
157156}
158157
159- func hasArg (s string ) bool {
160- argExist := false
161- flag .Visit (func (f * flag.Flag ) {
162- if f .Name == s {
163- argExist = true
164- }
165- })
166- return argExist
167- }
168-
169158func main () {
170159 var publisher Publisher
171160 var addresses app.StringArray
@@ -306,12 +295,12 @@ func parseCustomHeaders(strs []string) (map[string]string, error) {
306295 for _ , s := range strs {
307296 sp := strings .SplitN (s , ":" , 2 )
308297 if len (sp ) != 2 {
309- return nil , fmt .Errorf ("Invalid headers : %q" , s )
298+ return nil , fmt .Errorf ("invalid header : %q" , s )
310299 }
311300 key := strings .TrimSpace (sp [0 ])
312301 val := strings .TrimSpace (sp [1 ])
313302 if key == "" || val == "" {
314- return nil , fmt .Errorf ("Invalid headers : %q" , s )
303+ return nil , fmt .Errorf ("invalid header : %q" , s )
315304 }
316305 parsedHeaders [key ] = val
317306
0 commit comments