Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <[email protected]>
  • Loading branch information
rustatian committed Jan 21, 2022
1 parent b677ba1 commit dc03d97
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- errorlint # find code that will cause problems with the error wrapping scheme introduced in Go 1.13
- exhaustive # check exhaustiveness of enum switch statements
- exportloopref # checks for pointers to enclosing loop variables
- funlen # Tool for detection of long functions
- gochecknoglobals # Checks that no globals are present in Go code
- gochecknoinits # Checks that no init functions are present in Go code
- gocognit # Computes and checks the cognitive complexity of functions
Expand All @@ -67,11 +66,9 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- gosimple # Linter for Go source code that specializes in simplifying a code
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ineffassign # Detects when assignments to existing variables are not used
- lll # Reports long lines
- misspell # Finds commonly misspelled English words in comments
- nakedret # Finds naked returns in functions greater than a specified function length
- nestif # Reports deeply nested if statements
- nlreturn # checks for a new line before return and branch statements to increase code clarity
- noctx # finds sending http request without context.Context
- nolintlint # Reports ill-formed or insufficient nolint directives
- prealloc # Finds slice declarations that could potentially be preallocated
Expand All @@ -86,7 +83,6 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- unused # Checks Go code for unused constants, variables, functions and types
- varcheck # Finds unused global variables and constants
- whitespace # Tool for detection of leading and trailing whitespace
- wsl # Whitespace Linter - Forces you to use empty lines!

issues:
exclude-rules:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.17

require (
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d
github.com/roadrunner-server/api/v2 v2.0.0-rc.2
github.com/roadrunner-server/errors v1.1.0
github.com/roadrunner-server/api/v2 v2.8.0-rc.1
github.com/roadrunner-server/errors v1.1.1
go.uber.org/zap v1.20.0
)

Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,12 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/roadrunner-server/api/v2 v2.0.0-rc.2 h1:tuvIP5HqsoM2GORkjLojvzhxpwnOS+vgpyR+ZrWi9e8=
github.com/roadrunner-server/api/v2 v2.0.0-rc.2/go.mod h1:ChnLyPJ01qVRsVS/AEGV8hzny9dIfnv9edhGoeKSfAY=
github.com/roadrunner-server/api/v2 v2.8.0-rc.1 h1:MSHGvRGTbt5dtQPoen8THCCwVTLG8JPURVYVhLQRct0=
github.com/roadrunner-server/api/v2 v2.8.0-rc.1/go.mod h1:adh/nO9MHRcs4LP/MqTk0QdoNdwHomL9S4xzKQqw0s0=
github.com/roadrunner-server/errors v1.1.0 h1:ZjsvlJJkOpxNrZebo8DeXTCbytBIs+j2PjSrFmtqDAI=
github.com/roadrunner-server/errors v1.1.0/go.mod h1:MzHjhRZIZc1ooMyYllUhNs0aTqRUbwcgUSO0TN7kCII=
github.com/roadrunner-server/errors v1.1.1 h1:BzrB+xZE+iTISVfXSzIL9YbpPt6oHoRHgOBjlU/pigQ=
github.com/roadrunner-server/errors v1.1.1/go.mod h1:MzHjhRZIZc1ooMyYllUhNs0aTqRUbwcgUSO0TN7kCII=
github.com/roadrunner-server/goridge/v3 v3.3.0/go.mod h1:nOtQp0LEx2vxfnVT8/1PQIyK0BpFGhg8S0OCdlKdXbI=
github.com/roadrunner-server/sdk/v2 v2.0.0-rc.1/go.mod h1:p3ENuBdCHQGgUn8Xji4N5tRb6e5NXX8yKbgtHY/caxQ=
github.com/roadrunner-server/tcplisten v1.1.0/go.mod h1:2MjzsggdgxCca4p2k3YJdWdo/QnQehiOTy0knlE226c=
Expand Down
33 changes: 17 additions & 16 deletions memcachedkv/driver.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package memcachedkv

import (
stderr "errors"
"strings"
"time"

Expand All @@ -11,7 +12,7 @@ import (
"go.uber.org/zap"
)

type driver struct {
type Driver struct {
client *memcache.Client
log *zap.Logger
cfg *Config
Expand All @@ -20,10 +21,10 @@ type driver struct {
// NewMemcachedDriver returns a memcache client using the provided server(s)
// with equal weight. If a server is listed multiple times,
// it gets a proportional amount of weight.
func NewMemcachedDriver(log *zap.Logger, key string, cfgPlugin config.Configurer) (*driver, error) {
func NewMemcachedDriver(log *zap.Logger, key string, cfgPlugin config.Configurer) (*Driver, error) {
const op = errors.Op("new_memcached_driver")

s := &driver{
s := &Driver{
log: log,
}

Expand All @@ -44,7 +45,7 @@ func NewMemcachedDriver(log *zap.Logger, key string, cfgPlugin config.Configurer
}

// Has checks the key for existence
func (d *driver) Has(keys ...string) (map[string]bool, error) {
func (d *Driver) Has(keys ...string) (map[string]bool, error) {
const op = errors.Op("memcached_plugin_has")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
Expand All @@ -59,7 +60,7 @@ func (d *driver) Has(keys ...string) (map[string]bool, error) {

if err != nil {
// ErrCacheMiss means that a Get failed because the item wasn't present.
if err == memcache.ErrCacheMiss {
if stderr.Is(err, memcache.ErrCacheMiss) {
continue
}
return nil, errors.E(op, err)
Expand All @@ -73,7 +74,7 @@ func (d *driver) Has(keys ...string) (map[string]bool, error) {

// Get gets the item for the given key. ErrCacheMiss is returned for a
// memcache cache miss. The key must be at most 250 bytes in length.
func (d *driver) Get(key string) ([]byte, error) {
func (d *Driver) Get(key string) ([]byte, error) {
const op = errors.Op("memcached_plugin_get")
// to get cases like " "
keyTrimmed := strings.TrimSpace(key)
Expand All @@ -83,7 +84,7 @@ func (d *driver) Get(key string) ([]byte, error) {
data, err := d.client.Get(key)
if err != nil {
// ErrCacheMiss means that a Get failed because the item wasn't present.
if err == memcache.ErrCacheMiss {
if stderr.Is(err, memcache.ErrCacheMiss) {
return nil, nil
}
return nil, errors.E(op, err)
Expand All @@ -98,7 +99,7 @@ func (d *driver) Get(key string) ([]byte, error) {

// MGet return map with key -- string
// and map value as value -- []byte
func (d *driver) MGet(keys ...string) (map[string][]byte, error) {
func (d *Driver) MGet(keys ...string) (map[string][]byte, error) {
const op = errors.Op("memcached_plugin_mget")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
Expand All @@ -118,7 +119,7 @@ func (d *driver) MGet(keys ...string) (map[string][]byte, error) {
data, err := d.client.Get(keys[i])
if err != nil {
// ErrCacheMiss means that a Get failed because the item wasn't present.
if err == memcache.ErrCacheMiss {
if stderr.Is(err, memcache.ErrCacheMiss) {
continue
}
return nil, errors.E(op, err)
Expand All @@ -136,7 +137,7 @@ func (d *driver) MGet(keys ...string) (map[string][]byte, error) {
// Expiration is the cache expiration time, in seconds: either a relative
// time from now (up to 1 month), or an absolute Unix epoch time.
// Zero means the Item has no expiration time.
func (d *driver) Set(items ...*kvv1.Item) error {
func (d *Driver) Set(items ...*kvv1.Item) error {
const op = errors.Op("memcached_plugin_set")
if items == nil {
return errors.E(op, errors.NoKeys)
Expand Down Expand Up @@ -177,7 +178,7 @@ func (d *driver) Set(items ...*kvv1.Item) error {
// MExpire Expiration is the cache expiration time, in seconds: either a relative
// time from now (up to 1 month), or an absolute Unix epoch time.
// Zero means the Item has no expiration time.
func (d *driver) MExpire(items ...*kvv1.Item) error {
func (d *Driver) MExpire(items ...*kvv1.Item) error {
const op = errors.Op("memcached_plugin_mexpire")
for i := range items {
if items[i] == nil {
Expand Down Expand Up @@ -207,12 +208,12 @@ func (d *driver) MExpire(items ...*kvv1.Item) error {
}

// TTL return time in seconds (int32) for a given keys
func (d *driver) TTL(_ ...string) (map[string]string, error) {
func (d *Driver) TTL(_ ...string) (map[string]string, error) {
const op = errors.Op("memcached_plugin_ttl")
return nil, errors.E(op, errors.Str("not valid request for memcached, see https://github.com/memcached/memcached/issues/239"))
}

func (d *driver) Delete(keys ...string) error {
func (d *Driver) Delete(keys ...string) error {
const op = errors.Op("memcached_plugin_has")
if keys == nil {
return errors.E(op, errors.NoKeys)
Expand All @@ -231,7 +232,7 @@ func (d *driver) Delete(keys ...string) error {
// ErrCacheMiss means that a Get failed because the item wasn't present.
if err != nil {
// ErrCacheMiss means that a Get failed because the item wasn't present.
if err == memcache.ErrCacheMiss {
if stderr.Is(err, memcache.ErrCacheMiss) {
continue
}
return errors.E(op, err)
Expand All @@ -240,7 +241,7 @@ func (d *driver) Delete(keys ...string) error {
return nil
}

func (d *driver) Clear() error {
func (d *Driver) Clear() error {
err := d.client.DeleteAll()
if err != nil {
d.log.Error("flush_all operation failed", zap.Error(err))
Expand All @@ -250,6 +251,6 @@ func (d *driver) Clear() error {
return nil
}

func (d *driver) Stop() {
func (d *Driver) Stop() {
// not implemented https://github.com/bradfitz/gomemcache/issues/51
}

0 comments on commit dc03d97

Please sign in to comment.