vpkg-project / vpkg

An alternative package manager for V.
https://vpkg-project.github.io
MIT License
115 stars 10 forks source link

Compile errors with V 0.4.7 #40

Open jorgeluismireles opened 1 month ago

jorgeluismireles commented 1 month ago

Errors with current v:

~/vpkg$ v -version
V 0.4.7 01fd719
~/vpkg$ v -prod .
api/instance.v:28:1: error: const () groups will be an error after 2025-01-01 (`v fmt -w source.v` will fix that for you)
   26 | import os
   27 | 
   28 | const (
      | ~~~~~
   29 |     version = '0.7.1'
   30 |     global_modules_dir = os.home_dir() + '.vmodules'
api/instance.v:66:64: error: Option and Result types have been split, use `!Foo` to return errors
   64 | 
   65 |     match vpkg.command {
   66 |         'get'     { vpkg.get_packages(vpkg.unknown, true) or { return error("Failed to `get` packages")} }
      |                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   67 |         'help'    { vpkg.show_help() }
   68 |         'info'    { vpkg.show_package_information() }
api/instance.v:69:54: error: Option and Result types have been split, use `!Foo` to return errors
   67 |         'help'    { vpkg.show_help() }
   68 |         'info'    { vpkg.show_package_information() }
   69 |         'init'    { vpkg.create_manifest_file() or { return error("Failed to create manifest file (`init`)")} }
      |                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |         'link'    { vpkg.link(vpkg.dir) }
   71 |         'install' { vpkg.install_packages(vpkg.dir) or { return error("Failed to `install` packages")} }
api/instance.v:71:58: error: Option and Result types have been split, use `!Foo` to return errors
   69 |         'init'    { vpkg.create_manifest_file() or { return error("Failed to create manifest file (`init`)")} }
   70 |         'link'    { vpkg.link(vpkg.dir) }
   71 |         'install' { vpkg.install_packages(vpkg.dir) or { return error("Failed to `install` packages")} }
      |                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |         'remove'  { vpkg.remove_packages(vpkg.unknown) }
   73 |         'migrate' { if vpkg.unknown[0] == 'manifest' { vpkg.migrate_manifest() or { return error("Failed to `migrate` manifest")} } else {vpkg.show_help()} }
api/instance.v:73:85: error: Option and Result types have been split, use `!Foo` to return errors
   71 |         'install' { vpkg.install_packages(vpkg.dir) or { return error("Failed to `install` packages")} }
   72 |         'remove'  { vpkg.remove_packages(vpkg.unknown) }
   73 |         'migrate' { if vpkg.unknown[0] == 'manifest' { vpkg.migrate_manifest() or { return error("Failed to `migrate` manifest")} } else {vpkg.show_help()} }
      |                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   74 |         'update'  { vpkg.update_packages() }
   75 |         'unlink'  { vpkg.unlink(vpkg.dir) }
api/instance.v:78:55: error: Option and Result types have been split, use `!Foo` to return errors
   76 |         'version' { vpkg.show_version() }
   77 |         'test'    { vpkg.test_package() }
   78 |         'release' { vpkg.release_module_to_git() or { return error("Failed to `release` module")} }
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   79 |         else      { vpkg.show_help() }
   80 |     }
api/lockfile.v:44:13: error: Option and Result types have been split, use `!Foo` to return errors
   42 |     if os.exists(lockfile_path) {
   43 |         contents := os.read_file(lockfile_path) or {
   44 |             return error('Cannot read ${dir}')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   45 |         }
   46 |
api/lockfile.v:48:13: error: Option and Result types have been split, use `!Foo` to return errors
   46 | 
   47 |         decoded := json.decode(Lockfile, contents) or {
   48 |             return error('Unable to decode lockfile.')
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   49 |         }
   50 |
api/manifest.v:85:24: error: cannot use `!int` as type `?int` in return argument
   83 | 
   84 | fn (mut mw ManifestWriter) close() ?int {
   85 |     return mw.contents.write(('\n' + mw.closing).bytes())
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   86 | }
   87 |
api/manifest.v:107:43: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  105 |         mw.contents.writeln(message)
  106 |     } else {
  107 |         mw.contents.write(message.bytes())?
      |                                           ^
  108 |     }
  109 | }
api/manifest.v:125:105: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  123 |     if mw.contents.len == 0 { mw.init_write() }
  124 | 
  125 |     mw.contents.write((strings.repeat(` `, mw.spaces_count) + key_with_quotes + '${mw.colon} ').bytes())?
      |                                                                                                         ^
  126 | 
  127 |     message := '['
api/manifest.v:131:43: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  129 |         mw.contents.writeln(message)
  130 |     } else {
  131 |         mw.contents.write(message.bytes())?
      |                                           ^
  132 |     }
  133 |
api/manifest.v:142:87: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  140 | 
  141 |         if newline {
  142 |             mw.contents.write((strings.repeat(` `, mw.spaces_count*2) + text).bytes())?
      |                                                                                       ^
  143 |         } else {
  144 |             mw.contents.write(text.bytes())?
api/manifest.v:144:44: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  142 |             mw.contents.write((strings.repeat(` `, mw.spaces_count*2) + text).bytes())?
  143 |         } else {
  144 |             mw.contents.write(text.bytes())?
      |                                            ^
  145 |         }
  146 |     }
api/manifest.v:149:87: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  147 | 
  148 |     if newline {
  149 |         mw.contents.write(('\n' + strings.repeat(` `, mw.spaces_count) + ']').bytes())?
      |                                                                                       ^
  150 |     } else {
  151 |         mw.contents.write(']'.bytes())?
api/manifest.v:151:39: error: propagating a Result like an Option is deprecated, use `foo()!` instead of `foo()?`
  149 |         mw.contents.write(('\n' + strings.repeat(` `, mw.spaces_count) + ']').bytes())?
  150 |     } else {
  151 |         mw.contents.write(']'.bytes())?
      |                                       ^
  152 |     }
  153 | }
api/sources.v:54:44: error: type `net.http.Response` has no field named `text`.
5 possibilities: `body`, `header`, `http_version`, `status_code`, `status_msg`.
   52 |     }
   53 | 
   54 |     repo := json.decode(RegistryRepo, resp.text) or {
      |                                            ~~~~
   55 |         eprintln('Failed to read repo.json')
   56 |         return current_pkg
api/sources.v:54:18: error: json.decode: second argument needs to be a string
   52 |     }
   53 | 
   54 |     repo := json.decode(RegistryRepo, resp.text) or {
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   55 |         eprintln('Failed to read repo.json')
   56 |         return current_pkg
api/sources.v:90:42: error: type `net.http.Response` has no field named `text`.
5 possibilities: `body`, `header`, `http_version`, `status_code`, `status_msg`.
   88 |     }
   89 | 
   90 |     repo := json.decode(VpmPackage, resp.text) or {
      |                                          ~~~~
   91 |         eprintln('Failed to parse package information from VPM')
   92 |         return Package{}
api/sources.v:90:18: error: json.decode: second argument needs to be a string
   88 |     }
   89 | 
   90 |     repo := json.decode(VpmPackage, resp.text) or {
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   91 |         eprintln('Failed to parse package information from VPM')
   92 |         return Package{}
api/vmod.v:83:17: error: byte is deprecated, use u8 instead
   81 | }
   82 | 
   83 | fn is_newline(c byte) bool {
      |                 ~~~~
   84 |     return c == `\r` || c == `\n`
   85 | }
api/vmod.v:87:22: error: byte is deprecated, use u8 instead
   85 | }
   86 | 
   87 | fn is_name_alpha(chr byte) bool {
      |                      ~~~~
   88 |     return chr.is_letter() || chr == `_`
   89 | }
nedpals commented 1 month ago

Hi! vpkg is not maintained for a long while now. Feel free to submit a PR :)