aboutsummaryrefslogtreecommitdiffstats
path: root/storage/memory/storage.go
diff options
context:
space:
mode:
authorferhat elmas <elmas.ferhat@gmail.com>2017-11-29 02:24:31 +0100
committerferhat elmas <elmas.ferhat@gmail.com>2017-11-29 13:01:32 +0100
commit18e6f9daa3899318d36b525b068837f49bc2c1cf (patch)
treea797b79d0a750972ba9809eb52691cb09f9b6383 /storage/memory/storage.go
parentc07c778ed043429427533e2fd7549a3d54b903f1 (diff)
downloadgo-git-18e6f9daa3899318d36b525b068837f49bc2c1cf.tar.gz
all: simplification
- no length for map initialization - don't check for boolean/error return - don't format string - use string method of bytes buffer instead of converting bytes to string - use `strings.Contains` instead of `strings.Index` - use `bytes.Equal` instead of `bytes.Compare`
Diffstat (limited to 'storage/memory/storage.go')
-rw-r--r--storage/memory/storage.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/storage/memory/storage.go b/storage/memory/storage.go
index c9306ee..927ec41 100644
--- a/storage/memory/storage.go
+++ b/storage/memory/storage.go
@@ -30,17 +30,17 @@ type Storage struct {
// NewStorage returns a new Storage base on memory
func NewStorage() *Storage {
return &Storage{
- ReferenceStorage: make(ReferenceStorage, 0),
+ ReferenceStorage: make(ReferenceStorage),
ConfigStorage: ConfigStorage{},
ShallowStorage: ShallowStorage{},
ObjectStorage: ObjectStorage{
- Objects: make(map[plumbing.Hash]plumbing.EncodedObject, 0),
- Commits: make(map[plumbing.Hash]plumbing.EncodedObject, 0),
- Trees: make(map[plumbing.Hash]plumbing.EncodedObject, 0),
- Blobs: make(map[plumbing.Hash]plumbing.EncodedObject, 0),
- Tags: make(map[plumbing.Hash]plumbing.EncodedObject, 0),
+ Objects: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Commits: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Trees: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Blobs: make(map[plumbing.Hash]plumbing.EncodedObject),
+ Tags: make(map[plumbing.Hash]plumbing.EncodedObject),
},
- ModuleStorage: make(ModuleStorage, 0),
+ ModuleStorage: make(ModuleStorage),
}
}
@@ -152,7 +152,7 @@ func flattenObjectMap(m map[plumbing.Hash]plumbing.EncodedObject) []plumbing.Enc
func (o *ObjectStorage) Begin() storer.Transaction {
return &TxObjectStorage{
Storage: o,
- Objects: make(map[plumbing.Hash]plumbing.EncodedObject, 0),
+ Objects: make(map[plumbing.Hash]plumbing.EncodedObject),
}
}
@@ -189,7 +189,7 @@ func (tx *TxObjectStorage) Commit() error {
}
func (tx *TxObjectStorage) Rollback() error {
- tx.Objects = make(map[plumbing.Hash]plumbing.EncodedObject, 0)
+ tx.Objects = make(map[plumbing.Hash]plumbing.EncodedObject)
return nil
}