We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
写入路径的目录名或文件名带 "." 时,会不写入结果到文件中,如/tmp/.sss/1.json、test.xx.json这种,结果都不会写入
The text was updated successfully, but these errors were encountered:
这个小Bug存在于:module/finger/output.go文件的outfile函数,/tmp/.sss/1.json,test.xx.json 明显不会进入if逻辑,其次获取文件后缀的方式也有问题。
module/finger/output.go
outfile
/tmp/.sss/1.json
test.xx.json
func outfile(filename string, allresult []Outrestul) { file := strings.Split(filename, ".") if len(file) == 2 { if file[1] == "json" { buf, err := json.MarshalIndent(allresult, "", " ") if err != nil { fmt.Println(err.Error()) return } outjson(filename, buf) } if file[1] == "xlsx" { outxlsx(filename, allresult) } } }
修复后的代码:
func outfile(filename string, allresult []Outrestul) { fileExt := filepath.Ext(filename) //获取后缀名 .json .xlsx ,需要 import "path/filepath" if fileExt == ".json" { buf, err := json.MarshalIndent(allresult, "", " ") if err != nil { fmt.Println(err.Error()) return } outjson(filename, buf) } if fileExt == ".xlsx" { outxlsx(filename, allresult) } }
Sorry, something went wrong.
I'm meet the problems too, your job is good.
No branches or pull requests
写入路径的目录名或文件名带 "." 时,会不写入结果到文件中,如/tmp/.sss/1.json、test.xx.json这种,结果都不会写入
The text was updated successfully, but these errors were encountered: