1
0
Fork 0
forked from mirrors/tar-split

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 package storage
import ( import "github.com/vbatts/tar-split/tar/common"
"fmt"
"github.com/vbatts/tar-split/tar/common"
)
// Entries is for sorting by Position // Entries is for sorting by Position
type Entries []Entry 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 // GetName returns the string for the entry's name, regardless of the field stored in
func (e *Entry) GetName() string { func (e *Entry) GetName() string {
if len(e.NameRaw) > 0 { if len(e.NameRaw) > 0 {
return fmt.Sprintf("%s", e.NameRaw) return string(e.NameRaw)
} }
return e.Name return e.Name
} }