Skip to content

Type issues with v9.0.3 and cache v9 #83

@Goldziher

Description

@Goldziher

Hi there,

Given the following dependencies (from go.mod):

	github.com/go-redis/cache/v9 v9.0.0
	github.com/go-redis/redismock/v9 v9.0.3

I get this issue:

# github.com/go-redis/redismock/v9
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:905:20: m.factory.GetBit undefined (type redis.Cmdable has no field or method GetBit)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:912:20: m.factory.SetBit undefined (type redis.Cmdable has no field or method SetBit)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:919:20: m.factory.BitCount undefined (type redis.Cmdable has no field or method BitCount)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:926:20: m.factory.BitOpAnd undefined (type redis.Cmdable has no field or method BitOpAnd)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:933:20: m.factory.BitOpOr undefined (type redis.Cmdable has no field or method BitOpOr)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:940:20: m.factory.BitOpXor undefined (type redis.Cmdable has no field or method BitOpXor)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:947:20: m.factory.BitOpNot undefined (type redis.Cmdable has no field or method BitOpNot)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:954:20: m.factory.BitPos undefined (type redis.Cmdable has no field or method BitPos)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:961:20: m.factory.BitPosSpan undefined (type redis.Cmdable has no field or method BitPosSpan)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:968:20: m.factory.BitField undefined (type redis.Cmdable has no field or method BitField)
../../../go/pkg/mod/github.com/go-redis/redismock/[email protected]/mock.go:968:20: too many errors

I am executing the following test:

t.Run("Caches values as expected", func(t *testing.T) {
		_, err := rediscache.New("redis://redis:6379")
		assert.Nil(t, err)

		db, mockRedis := redismock.NewClientMock() //nolint: typecheck

		rediscache.SetClient(cache.New(&cache.Options{
			Redis: db,
		}))

		client := rediscache.GetClient()

		key := "john"

		val := &cache.Item{
			TTL:   time.Minute,
			Key:   key,
			Value: "doe",
		}

		expected, _ := client.Marshal("doe")

		mockRedis.ExpectSet(key, expected, time.Minute).SetVal("OK")
		setErr := client.Set(val)
		assert.NoError(t, setErr)
	})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions