Compare commits
No commits in common. "master" and "v0.22.30" have entirely different histories.
|
@ -1,17 +0,0 @@
|
||||||
package shell
|
|
||||||
|
|
||||||
import "regexp"
|
|
||||||
|
|
||||||
// splits strings. should work all the time
|
|
||||||
// A string with mixed line endings, including old Mac style (\r)
|
|
||||||
func SplitNewLines(input string) []string {
|
|
||||||
// This regex matches a carriage return and optional newline, OR just a newline.
|
|
||||||
// This covers \r\n, \n, and \r.
|
|
||||||
re := regexp.MustCompile(`\r\n?|\n|\r`)
|
|
||||||
|
|
||||||
// The -1 means there is no limit to the number of splits.
|
|
||||||
lines := re.Split(input, -1)
|
|
||||||
|
|
||||||
// Output: ["line one" "line two" "line three" "line four"]
|
|
||||||
return lines
|
|
||||||
}
|
|
2
wget.go
2
wget.go
|
@ -34,7 +34,7 @@ func Wget(url string) *bytes.Buffer {
|
||||||
|
|
||||||
log.Log(INFO, "res.StatusCode: %d\n", resp.StatusCode)
|
log.Log(INFO, "res.StatusCode: %d\n", resp.StatusCode)
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
handleError(fmt.Errorf("%d", resp.StatusCode), -1)
|
handleError(fmt.Errorf(fmt.Sprintf("%d", resp.StatusCode)), -1)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue