Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 97326a8

Browse files
committed
optimise code
1 parent a869d3c commit 97326a8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/conv.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ func convHelper(oldPrefixValue, newPrefixValue string) bool {
4848
sBuf := string(buf)
4949
originUrl := ""
5050
checkErr(err, "Convert failed.", 8)
51-
tmp := strings.Split(strings.Replace(strings.Replace(sBuf, "\t", " ", -1), " ", " ", -1), " ")
51+
tmp := strings.Split(
52+
strings.Replace(
53+
strings.Replace(sBuf, "\t", " ", -1),
54+
" ", " ", -1),
55+
" ")
56+
5257
for i := range tmp {
5358
if strings.HasPrefix(tmp[i], oldPrefixValue) {
5459
originUrl = tmp[i]

src/jsdget.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ func (j *JsdFunc) Run(args []string) {
1818
case 2:
1919
jsdget(args[0], args[1])
2020
}
21+
os.Exit(0)
2122
}
2223

2324
func jsdget(url string, fpath string) {
2425
if url == "" || url == "--help" || url == "-h" {
2526
fmt.Println(jsdHelpMsg)
26-
os.Exit(0)
2727
} else {
2828
downloadFile(parseToJsdUrl(url), fpath)
2929
}

0 commit comments

Comments
 (0)