Go

Go

Made by DeepSource

Use of deprecated Redis methods GO-W1000

Bug risk
Major
Autofix

Usage of deprecated methods should be avoided as they are not maintained and could be buggy and insecure. These methods should not be used except for compatibility with legacy systems.

Currently, we support detection of these deprecated methods: - "XTrim" - "XTrimApprox" - "ZAddCh" - "ZAddNXCh" - "ZAddXXCh" - "ZIncr" - "ZIncrNX" - "ZIncrXX"

The lint's message points to the documentation to understand what should be done and replace the deprecated method with.

Bad practice

ctx := context.TODO()
client := redis.NewClient(&redis.Options{})

// The following methods are deprecated
client.XTrim(ctx, "", 0)
client.XTrimApprox(ctx, "", 0)
client.ZAddCh(ctx, "", &redis.Z{})
client.ZAddNXCh(ctx, "", &redis.Z{})
client.ZAddXXCh(ctx, "", &redis.Z{})
client.ZIncr(ctx, "", &redis.Z{})
client.ZIncrNX(ctx, "", &redis.Z{})
client.ZIncrXX(ctx, "", &redis.Z{})

References