diff options
Diffstat (limited to 'wget.go')
| -rw-r--r-- | wget.go | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1,6 +1,6 @@ package shell -/* +/* This simply parses the command line arguments using the default golang package called 'flag'. This can be used as a simple template to parse command line arguments in other programs. @@ -11,17 +11,17 @@ package shell */ import ( + "bytes" + "fmt" "io" + "net/http" "os" - "fmt" - "bytes" "strings" - "net/http" "go.wit.com/log" ) -func Wget(url string) (*bytes.Buffer) { +func Wget(url string) *bytes.Buffer { buf := new(bytes.Buffer) // Get the data @@ -33,7 +33,7 @@ func Wget(url string) (*bytes.Buffer) { defer resp.Body.Close() log.Log(INFO, "res.StatusCode: %d\n", resp.StatusCode) - if (resp.StatusCode != 200) { + if resp.StatusCode != 200 { handleError(fmt.Errorf(fmt.Sprint("%d", resp.StatusCode)), -1) return nil } @@ -72,7 +72,6 @@ func WgetToFile(filepath string, url string) error { // package. I will quote the evilwm man page: // // BUGS: The author's idea of friendly may differ to that of many other people. -// func Write(filepath string, data string) bool { // TODO: this isn't working for some reason and is making two '\n' chars // probably because Chomp() isn't fixed yet |
