Skip to content

Commit

Permalink
⚓ all: minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
database64128 committed Aug 25, 2024
1 parent 91a8ff4 commit cc29c1f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/shadowsocks-go-domain-set-converter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func DomainSetBuilderFromDlc(text string) (domainset.Builder, error) {

end := strings.IndexByte(line, '@')
if end == 0 {
return dsb, fmt.Errorf("invalid line: %s", line)
return dsb, fmt.Errorf("invalid line: %q", line)
}

if *tag == "" { // select all lines
Expand All @@ -159,7 +159,7 @@ func DomainSetBuilderFromDlc(text string) (domainset.Builder, error) {
case strings.HasPrefix(line, regexpPrefix):
dsb.RegexpMatcherBuilder().Insert(line[regexpPrefixLen:end])
default:
return dsb, fmt.Errorf("invalid line: %s", line)
return dsb, fmt.Errorf("invalid line: %q", line)
}
}

Expand Down
2 changes: 1 addition & 1 deletion domainset/domainset.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (dsb Builder) WriteText(w io.Writer) error {
regexpCount, regexpSeq := dsb.RegexpMatcherBuilder().Rules()
capacityHint := fmt.Sprintf("%s%d %d %d %d %s\n", capacityHintPrefix, domainCount, suffixCount, keywordCount, regexpCount, capacityHintSuffix)

bw := bufio.NewWriter(w)
bw := bufio.NewWriterSize(w, 128*1024)
if _, err := bw.WriteString(capacityHint); err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion mmap/mmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ func TestReadFile(t *testing.T) {
t.Fatal(err)
}
name := f.Name()
defer os.Remove(name)

_, err = f.WriteString(name)
f.Close()
Expand Down

0 comments on commit cc29c1f

Please sign in to comment.