v icon indicating copy to clipboard operation
v copied to clipboard

Importing modules with capital letters fails

Open Bowero opened this issue 6 years ago • 2 comments

OS: linux, Arch Linux
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
CC version: cc (GCC) 10.2.0
-----------------------------------------------------------------------------------------------------
vroot: /home/bowero/v
vexe: /home/bowero/v/v
vexe mtime: 2020-09-21 20:19:47
is vroot writable: true
V full version: V 0.1.29 1ee0939
-----------------------------------------------------------------------------------------------------
Git version: git version 2.28.0
Git vroot status: 0.1.29-387-g1ee0939f
.git/config present: true
/var/tmp/tcc status: master 5e73982e
thirdparty/tcc: N/A
-----------------------------------------------------------------------------------------------------

What did you do? I imported one of my old modules with v install Bowero.owmw.

What did you expect to see? I expected this module to be imported normally. However, since Bowero has an uppercase letter in it, this fails.

What did you see instead?

/home/bowero/.vmodules/Bowero/owmw/city.v:1:1: error: module name `Bowero.owmw` cannot contain uppercase letters, use snake_case instead
    1 | module owmw
      | ~~~~~~~~~~~
    2 | 
    3 | import net.http

I understand that uppercase letters aren't allowed, however, as an end user I can't help it that a developer used a capital letter in his or her module, especially when it's part of the username. The package was installed through the official VPM registry, so I expect these to be alright.

An easy fix would be to automatically transform all v install requests to lowercase. This way, you won't be reliant on the developers of the modules or the VPM registry.

Before I make any changes however, I would like to know what the community thinks. Is this the right solution?

Bowero avatar Sep 21 '20 21:09 Bowero

An easy fix would be to automatically transform all v install requests to lowercase.

Yes that's what I was also thinking.

medvednikov avatar Sep 21 '20 23:09 medvednikov

It would have to be transformed only after received. You still have to request it from the remote site using the correct case. At least on some systems. It would be easier if it was always requested with the correct case.

JalonSolov avatar Sep 21 '20 23:09 JalonSolov