patrickpissurno / vredis

Redis client for V, written in V
MIT License
67 stars 10 forks source link

Bad module error #14

Closed tintin10q closed 1 year ago

tintin10q commented 1 year ago

My v can't find the module.

I installed it like this just to be sure:

v install --git https://github.com/patrickpissurno/vredis
v install patrickpissurno.redis

But when I tried to import it I get:

main.v:2:1: builder error: cannot import module "vredis" (not found)
    1 | import vweb
    2 | import vredis

This is weird because my editor does say its installed.

Also when I change it to import redis I get:

main.v:2:1: builder error: bad module definition: v imports module "redis" but /home/qc/.vmodules/redis/vredis.v is defined as module `vredis`
    1 | import vweb
    2 | import redis
      | ~~~~~~~~~~~~
    3 | 
    4 |

So did you name someting wrong? Idk it doesn't work.

gokomer commented 1 year ago

It looks like module name and the first module access name are different. Until a new version released you can change the vredis.v file to redis.v and module vredis to module redis in module folder. After that you can import it as import patrickpissurno.redis

patrickpissurno commented 1 year ago

Thanks for spotting this, and thanks @gokomer for working on a fix! I've merged it and I'll bump the version number