mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
some optimizations
This commit is contained in:
parent
f0a9462041
commit
87d53b5018
@ -152,7 +152,7 @@ func (e *Editor) PutSegment(seg *Segment) (int, int, error) {
|
||||
found = true
|
||||
}
|
||||
|
||||
if found == false {
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ func (e *Editor) PutFile(src string) (int, int, error) {
|
||||
|
||||
func (e *Editor) Save() error {
|
||||
// check the to-save flag
|
||||
if e.toSave == false {
|
||||
if !e.toSave {
|
||||
return fmt.Errorf("nothing changed")
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +161,7 @@ func TestIterateSegments(t *testing.T) {
|
||||
t.Fatalf("failed to open tests file: %s", err)
|
||||
}
|
||||
|
||||
err = IterateSegments(handle, func(l string) {
|
||||
_ = IterateSegments(handle, func(l string) {
|
||||
// fmt.Printf("load segment: `%s`\n", l)
|
||||
}, func(seg *Segment) error {
|
||||
fmt.Printf("get segment: `%s`\n", seg)
|
||||
|
||||
@ -29,7 +29,7 @@ type Version struct {
|
||||
}
|
||||
|
||||
func (v *Version) String() string {
|
||||
return fmt.Sprintf("{Id:%d, Name:%d, Bytes:%d, IndexSize: %d}", v.Id, v.Name, v.Bytes, v.SegmentIndexSize)
|
||||
return fmt.Sprintf("{Id:%d, Name:%s, Bytes:%d, IndexSize: %d}", v.Id, v.Name, v.Bytes, v.SegmentIndexSize)
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user