1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-11-14 12:38:38 +00:00

tar/storage: Sprintf is unnecessary

fmt.Sprintf() vs string() for this []byte conversion is too much and
does not provide any further safety.

https://gist.github.com/vbatts/ab17181086aed558dd3a
This commit is contained in:
Vincent Batts 2015-09-24 09:51:58 -04:00
parent 7f56c08c48
commit 8a361ef0d8

View file

@ -1,10 +1,6 @@
package storage
import (
"fmt"
"github.com/vbatts/tar-split/tar/common"
)
import "github.com/vbatts/tar-split/tar/common"
// Entries is for sorting by Position
type Entries []Entry
@ -68,7 +64,7 @@ func (e *Entry) SetNameBytes(name []byte) {
// GetName returns the string for the entry's name, regardless of the field stored in
func (e *Entry) GetName() string {
if len(e.NameRaw) > 0 {
return fmt.Sprintf("%s", e.NameRaw)
return string(e.NameRaw)
}
return e.Name
}