Skip to content

Commit

Permalink
chore: improve code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
fufuok committed Nov 6, 2024
1 parent a07908d commit a5b18b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func RuneReverse(s string) string {
// Reverse 反转字符串
func Reverse(s string) string {
b := []byte(s)
for i, j := 0, len(b)-1; i < len(b)/2; i, j = i+1, j-1 {
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
b[i], b[j] = b[j], b[i]
}
return B2S(b)
Expand Down
2 changes: 1 addition & 1 deletion xfile/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func ReadLines(filename string) ([]string, error) {
func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error) {
f, err := os.Open(filename)
if err != nil {
return []string{""}, err
return nil, err
}
defer func() {
_ = f.Close()
Expand Down

0 comments on commit a5b18b0

Please sign in to comment.