sticter golangci config, fix discovered issues
This commit is contained in:
committed by
Umputun
parent
2acb00d424
commit
513c8f353d
@@ -75,7 +75,7 @@ func (m *MemAdmin) OnEvent(siteID string, ev admin.EventType) error {
|
||||
return errors.Errorf("site %s not found", siteID)
|
||||
}
|
||||
if ev == admin.EvCreate {
|
||||
resp.CountCreated += 1 // not a good idea, just for demo
|
||||
resp.CountCreated++ // not a good idea, just for demo
|
||||
m.data[siteID] = resp
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -33,6 +33,7 @@ func NewMemImageStore() *MemImage {
|
||||
}
|
||||
}
|
||||
|
||||
// Save stores image with passed id to staging
|
||||
func (m *MemImage) Save(id string, img []byte) error {
|
||||
m.Lock()
|
||||
m.imagesStaging[id] = img
|
||||
@@ -42,6 +43,7 @@ func (m *MemImage) Save(id string, img []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Load image by ID
|
||||
func (m *MemImage) Load(id string) ([]byte, error) {
|
||||
m.RLock()
|
||||
img, ok := m.images[id]
|
||||
@@ -55,6 +57,7 @@ func (m *MemImage) Load(id string) ([]byte, error) {
|
||||
return img, nil
|
||||
}
|
||||
|
||||
// Commit moves image from staging to permanent
|
||||
func (m *MemImage) Commit(id string) error {
|
||||
m.RLock()
|
||||
img, ok := m.imagesStaging[id]
|
||||
@@ -70,6 +73,7 @@ func (m *MemImage) Commit(id string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Cleanup runs removal loop for old images on staging
|
||||
func (m *MemImage) Cleanup(_ context.Context, ttl time.Duration) error {
|
||||
var idsToRemove []string
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ require (
|
||||
github.com/go-pkgz/jrpc v0.1.0
|
||||
github.com/go-pkgz/lgr v0.7.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rs/xid v1.2.1
|
||||
github.com/stretchr/testify v1.5.1
|
||||
github.com/umputun/go-flags v1.5.1
|
||||
github.com/umputun/remark/backend v1.5.0
|
||||
|
||||
Reference in New Issue
Block a user