From 659a140afc5d2ac9831ec8fe9dab81c37d4afc12 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Tue, 4 Jun 2013 09:34:24 +0200 Subject: [PATCH] do not use bytes.Buffer for idToKeyBuf --- cache/osm.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cache/osm.go b/cache/osm.go index 0f317f3..898c4f2 100644 --- a/cache/osm.go +++ b/cache/osm.go @@ -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] }