do not use bytes.Buffer for idToKeyBuf

master
Oliver Tonnhofer 2013-06-04 09:34:24 +02:00
parent c00cfaf030
commit 659a140afc
1 changed files with 2 additions and 4 deletions

6
cache/osm.go vendored
View File

@ -1,7 +1,6 @@
package cache
import (
"bytes"
bin "encoding/binary"
"errors"
"github.com/jmhodges/levigo"
@ -179,9 +178,8 @@ func (c *Cache) open(path string) error {
}
func idToKeyBuf(id int64) []byte {
b := make([]byte, 0, 8)
buf := bytes.NewBuffer(b)
bin.Write(buf, bin.BigEndian, &id)
b := make([]byte, 8)
bin.BigEndian.PutUint64(b, uint64(id))
return b[:8]
}