Skip to content

Installation not working on Mac #10

Open
@marhu98

Description

@marhu98

When I run

v -prod .

I get:

./array.v:8:14: warning: use `x := []Type{}` instead of `x := []Type`
    6 | // []string 去重
    7 | fn string_array_distinct(arr []string)[]string{
    8 |     mut res:=[]string
      |              ~~~~~~~~
    9 |     for v in arr{
   10 |         if !v in res{
./command.v:115:15: warning: use `x := []Type{}` instead of `x := []Type`
  113 |         return 
  114 |     }
  115 |     mut pkgs:=[]PkgInfo
      |               ~~~~~~~~~
  116 |     mut rm_names:=[]string
  117 |     for p in store.packages{
./command.v:116:19: warning: use `x := []Type{}` instead of `x := []Type`
  114 |     }
  115 |     mut pkgs:=[]PkgInfo
  116 |     mut rm_names:=[]string
      |                   ~~~~~~~~
  117 |     for p in store.packages{
  118 |         if !p.name in names{
./util.v:124:31: warning: `fn f(x, y Type)` syntax has been deprecated and will soon be removed. Use `fn f(x Type, y Type)` instead. You can run `v fmt -w "./util.v"` to automatically fix your code.
  122 | 
  123 | // 通过git下载包
  124 | fn fetch_pkg_from_git(lib_name,git_url string)PkgInfo{
      |                               ^
  125 |     pkg_info:=PkgInfo{name:lib_name,repo:git_url}
  126 |     lib_path:=get_vlib_path()+'/$lib_name'
./vpm.v:3:5: warning: const names cannot contain uppercase letters, use snake_case instead
    1 | module main
    2 | const (
    3 |     PKG_NAME = 'vpm.json'
      |     ~~~~~~~~
    4 |     VERSION = '0.0.2'
    5 |     VROOT = get_v_root_path()
./vpm.v:4:5: warning: const names cannot contain uppercase letters, use snake_case instead
    2 | const (
    3 |     PKG_NAME = 'vpm.json'
    4 |     VERSION = '0.0.2'
      |     ~~~~~~~
    5 |     VROOT = get_v_root_path()
    6 | )
./vpm.v:5:5: warning: const names cannot contain uppercase letters, use snake_case instead
    3 |     PKG_NAME = 'vpm.json'
    4 |     VERSION = '0.0.2'
    5 |     VROOT = get_v_root_path()
      |     ~~~~~
    6 | )
    7 |
./array.v:10:12: error: ! operator can only be used with bool types
    8 |     mut res:=[]string
    9 |     for v in arr{
   10 |         if !v in res{
      |            ^
   11 |             res<<v
   12 |         }
./command.v:118:12: error: ! operator can only be used with bool types
  116 |     mut rm_names:=[]string
  117 |     for p in store.packages{
  118 |         if !p.name in names{
      |            ^
  119 |             pkgs<<p
  120 |         }else{
./util.v:31:8: error: os.rm() returns an option, so it should have either an `or {}` block, or `?` at the end
   29 | // 删除包管理文件
   30 | fn rm_store_path(){
   31 |     os.rm(get_store_path())
      |        ~~~~~~~~~~~~~~~~~~~~
   32 | }
   33 |
./util.v:41:15: error: unknown function: os.filename
   39 | // 获取项目默认名称(当前所在目录名称)
   40 | fn get_default_project_name()string{
   41 |     return os.filename(os.getwd())
      |               ~~~~~~~~~~~~~~~~~~~~
   42 | }
   43 |
./util.v:62:18: error: unknown function: os.filename
   60 | // 从git url 上获取 lib 名称
   61 | fn get_lib_name(git_url string)string{
   62 |     mut name:=os.filename(git_url)
      |                  ~~~~~~~~~~~~~~~~~
   63 |     if name.ends_with('.git'){
   64 |         name=name.replace('.git','')
./util.v:63:13: error: non-bool type `void` used as if condition
   61 | fn get_lib_name(git_url string)string{
   62 |     mut name:=os.filename(git_url)
   63 |     if name.ends_with('.git'){
      |             ~~~~~~~~~~~~~~~~~
   64 |         name=name.replace('.git','')
   65 |     }
./util.v:64:13: error: assignment mismatch: 1 variable(s) but `replace()` returns 0 value(s)
   62 |     mut name:=os.filename(git_url)
   63 |     if name.ends_with('.git'){
   64 |         name=name.replace('.git','')
      |             ^
   65 |     }
   66 |     return name
./util.v:66:12: error: cannot use `void` as type `string` in return argument
   64 |         name=name.replace('.git','')
   65 |     }
   66 |     return name
      |            ~~~~
   67 | }
   68 | // 检测是否是git url
./util.v:80:16: error: cannot use `string` as `[]byte` in argument 1 to `os.File.write`
   78 |         return 
   79 |     }
   80 |     file.write(content)
      |                ~~~~~~~
   81 |     file.close()
   82 | }
./util.v:134:17: error: function `os.exec` has been deprecated; use os.execute or os.execute_or_panic instead
  132 |     // clone lib
  133 |     println('fetching "$lib_name" from "$git_url" ...')
  134 |     git_res:=os.exec('git clone $git_url $lib_path') or {
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135 |         println('fetch failed')
  136 |         return PkgInfo{name:'',repo:''}

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