Skip to content
New issue

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

all: remove unnecessary string([]byte) conversion in fmt.Sprintf yet %s #590

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iter_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (iter *Iterator) ReadObject() (ret string) {
case '}':
return "" // end of object
default:
iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %s`, string([]byte{c})))
iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %c`, c))
return
}
}
Expand Down
14 changes: 7 additions & 7 deletions iter_skip.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,34 +97,34 @@ func (iter *Iterator) Skip() {

func (iter *Iterator) skipFourBytes(b1, b2, b3, b4 byte) {
if iter.readByte() != b1 {
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3, b4}))
return
}
if iter.readByte() != b2 {
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3, b4}))
return
}
if iter.readByte() != b3 {
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3, b4}))
return
}
if iter.readByte() != b4 {
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3, b4}))
return
}
}

func (iter *Iterator) skipThreeBytes(b1, b2, b3 byte) {
if iter.readByte() != b1 {
iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3})))
iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3}))
return
}
if iter.readByte() != b2 {
iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3})))
iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3}))
return
}
if iter.readByte() != b3 {
iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3})))
iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", []byte{b1, b2, b3}))
return
}
}