vlang / gitly

Light and fast GitHub/GitLab alternative written in V
GNU General Public License v3.0
1.37k stars 72 forks source link

compilation errors V 0.4 fix #270

Closed KeitoTobi1 closed 1 week ago

KeitoTobi1 commented 1 month ago

Builing Error:

src/repo_routes.v:89:28: error: method `repo_settings` parameter `ctx` is `mut`, so use `mut username` instead
   87 |     } else {
   88 |         ctx.error('Verification failed')
   89 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                  ~~~~~~~~
   90 |     }
   91 |
src/repo_routes.v:89:28: error: cannot use `string` as `&Context` in argument 1 to `App.repo_settings`
   87 |     } else {
   88 |         ctx.error('Verification failed')
   89 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                  ~~~~~~~~
   90 |     }
   91 |
src/repo_routes.v:89:53: error: `repo_settings` parameter `repo_name` is not `mut`, `mut` is not needed`
   87 |     } else {
   88 |         ctx.error('Verification failed')
   89 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                                           ~~~
   90 |     }
   91 |
src/repo_routes.v:89:53: error: cannot use `&Context` as `string` in argument 3 to `App.repo_settings`
   87 |     } else {
   88 |         ctx.error('Verification failed')
   89 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                                           ~~~
   90 |     }
   91 |
src/repo_routes.v:109:29: error: method `repo_settings` parameter `ctx` is `mut`, so use `mut username` instead
  107 |         dest_user := app.get_user_by_username(dest) or {
  108 |             ctx.error('Unknown user ${dest}')
  109 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  110 |         }
  111 |
src/repo_routes.v:109:29: error: cannot use `string` as `&Context` in argument 1 to `App.repo_settings`
  107 |         dest_user := app.get_user_by_username(dest) or {
  108 |             ctx.error('Unknown user ${dest}')
  109 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  110 |         }
  111 |
src/repo_routes.v:109:54: error: `repo_settings` parameter `repo_name` is not `mut`, `mut` is not needed`
  107 |         dest_user := app.get_user_by_username(dest) or {
  108 |             ctx.error('Unknown user ${dest}')
  109 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  110 |         }
  111 |
src/repo_routes.v:109:54: error: cannot use `&Context` as `string` in argument 3 to `App.repo_settings`
  107 |         dest_user := app.get_user_by_username(dest) or {
  108 |             ctx.error('Unknown user ${dest}')
  109 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  110 |         }
  111 |
src/repo_routes.v:114:29: error: method `repo_settings` parameter `ctx` is `mut`, so use `mut username` instead
  112 |         if app.user_has_repo(dest_user.id, repo.name) {
  113 |             ctx.error('User already owns repo ${repo.name}')
  114 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  115 |         }
  116 |
src/repo_routes.v:114:29: error: cannot use `string` as `&Context` in argument 1 to `App.repo_settings`
  112 |         if app.user_has_repo(dest_user.id, repo.name) {
  113 |             ctx.error('User already owns repo ${repo.name}')
  114 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  115 |         }
  116 |
src/repo_routes.v:114:54: error: `repo_settings` parameter `repo_name` is not `mut`, `mut` is not needed`
  112 |         if app.user_has_repo(dest_user.id, repo.name) {
  113 |             ctx.error('User already owns repo ${repo.name}')
  114 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  115 |         }
  116 |
src/repo_routes.v:114:54: error: cannot use `&Context` as `string` in argument 3 to `App.repo_settings`
  112 |         if app.user_has_repo(dest_user.id, repo.name) {
  113 |             ctx.error('User already owns repo ${repo.name}')
  114 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  115 |         }
  116 |
src/repo_routes.v:119:29: error: method `repo_settings` parameter `ctx` is `mut`, so use `mut username` instead
  117 |         if app.get_count_user_repos(dest_user.id) >= max_user_repos {
  118 |             ctx.error('User already reached the repo limit')
  119 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  120 |         }
  121 |
src/repo_routes.v:119:29: error: cannot use `string` as `&Context` in argument 1 to `App.repo_settings`
  117 |         if app.get_count_user_repos(dest_user.id) >= max_user_repos {
  118 |             ctx.error('User already reached the repo limit')
  119 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  120 |         }
  121 |
src/repo_routes.v:119:54: error: `repo_settings` parameter `repo_name` is not `mut`, `mut` is not needed`
  117 |         if app.get_count_user_repos(dest_user.id) >= max_user_repos {
  118 |             ctx.error('User already reached the repo limit')
  119 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  120 |         }
  121 |
src/repo_routes.v:119:54: error: cannot use `&Context` as `string` in argument 3 to `App.repo_settings`
  117 |         if app.get_count_user_repos(dest_user.id) >= max_user_repos {
  118 |             ctx.error('User already reached the repo limit')
  119 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  120 |         }
  121 |
src/repo_routes.v:124:29: error: method `repo_settings` parameter `ctx` is `mut`, so use `mut username` instead
  122 |         app.move_repo_to_user(repo.id, dest_user.id, dest_user.username) or {
  123 |             ctx.error('There was an error while moving the repo')
  124 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  125 |         }
  126 |
src/repo_routes.v:124:29: error: cannot use `string` as `&Context` in argument 1 to `App.repo_settings`
  122 |         app.move_repo_to_user(repo.id, dest_user.id, dest_user.username) or {
  123 |             ctx.error('There was an error while moving the repo')
  124 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                      ~~~~~~~~
  125 |         }
  126 |
src/repo_routes.v:124:54: error: `repo_settings` parameter `repo_name` is not `mut`, `mut` is not needed`
  122 |         app.move_repo_to_user(repo.id, dest_user.id, dest_user.username) or {
  123 |             ctx.error('There was an error while moving the repo')
  124 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  125 |         }
  126 |
src/repo_routes.v:124:54: error: cannot use `&Context` as `string` in argument 3 to `App.repo_settings`
  122 |         app.move_repo_to_user(repo.id, dest_user.id, dest_user.username) or {
  123 |             ctx.error('There was an error while moving the repo')
  124 |             return app.repo_settings(username, repo_name, mut ctx)
      |                                                               ~~~
  125 |         }
  126 |
src/repo_routes.v:131:28: error: method `repo_settings` parameter `ctx` is `mut`, so use `mut username` instead
  129 |         ctx.error('Verification failed')
  130 |
  131 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                  ~~~~~~~~
  132 |     }
  133 |
src/repo_routes.v:131:28: error: cannot use `string` as `&Context` in argument 1 to `App.repo_settings`
  129 |         ctx.error('Verification failed')
  130 |
  131 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                  ~~~~~~~~
  132 |     }
  133 |
src/repo_routes.v:131:53: error: `repo_settings` parameter `repo_name` is not `mut`, `mut` is not needed`
  129 |         ctx.error('Verification failed')
  130 |
  131 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                                           ~~~
  132 |     }
  133 |
src/repo_routes.v:131:53: error: cannot use `&Context` as `string` in argument 3 to `App.repo_settings`
  129 |         ctx.error('Verification failed')
  130 |
  131 |         return app.repo_settings(username, repo_name, mut ctx)
      |                                                           ~~~
  132 |     }
  133 |
src/repo_routes.v:142:26: error: method `user_repos` parameter `ctx` is `mut`, so use `mut username` instead
  140 |     match repo_name {
  141 |         'repos' {
  142 |             return app.user_repos(username, mut ctx)
      |                                   ~~~~~~~~
  143 |         }
  144 |         'issues' {
src/repo_routes.v:142:26: error: cannot use `string` as `&Context` in argument 1 to `App.user_repos`
  140 |     match repo_name {
  141 |         'repos' {
  142 |             return app.user_repos(username, mut ctx)
      |                                   ~~~~~~~~
  143 |         }
  144 |         'issues' {
src/repo_routes.v:142:40: error: `user_repos` parameter `username` is not `mut`, `mut` is not needed`
  140 |     match repo_name {
  141 |         'repos' {
  142 |             return app.user_repos(username, mut ctx)
      |                                                 ~~~
  143 |         }
  144 |         'issues' {
src/repo_routes.v:142:40: error: cannot use `&Context` as `string` in argument 2 to `App.user_repos`
  140 |     match repo_name {
  141 |         'repos' {
  142 |             return app.user_repos(username, mut ctx)
      |                                                 ~~~
  143 |         }
  144 |         'issues' {
src/repo_routes.v:145:38: error: method `handle_get_user_issues` parameter `ctx` is `mut`, so use `mut username` instead
  143 |         }
  144 |         'issues' {
  145 |             return app.handle_get_user_issues(username, mut ctx)
      |                                               ~~~~~~~~
  146 |         }
  147 |         'settings' {
src/repo_routes.v:145:38: error: cannot use `string` as `&Context` in argument 1 to `App.handle_get_user_issues`
  143 |         }
  144 |         'issues' {
  145 |             return app.handle_get_user_issues(username, mut ctx)
      |                                               ~~~~~~~~
  146 |         }
  147 |         'settings' {
src/repo_routes.v:145:52: error: `handle_get_user_issues` parameter `username` is not `mut`, `mut` is not needed`
  143 |         }
  144 |         'issues' {
  145 |             return app.handle_get_user_issues(username, mut ctx)
      |                                                             ~~~
  146 |         }
  147 |         'settings' {
src/repo_routes.v:145:52: error: cannot use `&Context` as `string` in argument 2 to `App.handle_get_user_issues`
  143 |         }
  144 |         'issues' {
  145 |             return app.handle_get_user_issues(username, mut ctx)
      |                                                             ~~~
  146 |         }
  147 |         'settings' {
src/tag_routes.v:25:13: error: expected 3 arguments, but got 2
   23 |     archive_content := os.read_file(archive_path) or { return ctx.not_found() }
   24 |
   25 |     return app.send_file(snapshot_name, archive_content)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   26 | }
Details: have (string, string)
         want (&main.Context, string, string)
src/user_routes.v:103:14: error: expected 2 arguments, but got 1
  101 |         ctx.error('New name is empty')
  102 |
  103 |         return app.user_settings(username)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~
  104 |     }
  105 |
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:109:14: error: expected 2 arguments, but got 1
  107 |         ctx.error('You can not change your username, limit reached')
  108 |
  109 |         return app.user_settings(username)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~
  110 |     }
  111 |
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:117:14: error: expected 2 arguments, but got 1
  115 |         ctx.error('New username is not valid')
  116 |
  117 |         return app.user_settings(username)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~
  118 |     }
  119 |
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:126:14: error: expected 2 arguments, but got 1
  124 |         ctx.error('You need to wait until you can change the name again')
  125 |
  126 |         return app.user_settings(username)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~
  127 |     }
  128 |
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:135:15: error: expected 2 arguments, but got 1
  133 |         app.change_full_name(ctx.user.id, full_name) or {
  134 |             ctx.error('There was an error while updating the settings')
  135 |             return app.user_settings(username)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~
  136 |         }
  137 |     }
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:145:15: error: expected 2 arguments, but got 1
  143 |             ctx.error('Name already exists')
  144 |
  145 |             return app.user_settings(username)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~
  146 |         }
  147 |
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:150:15: error: expected 2 arguments, but got 1
  148 |         app.change_username(ctx.user.id, new_username) or {
  149 |             ctx.error('There was an error while updating the settings')
  150 |             return app.user_settings(username)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~
  151 |         }
  152 |         app.incement_namechanges(ctx.user.id) or {
Details: have (string)
         want (&main.Context, string)
src/user_routes.v:154:15: error: expected 2 arguments, but got 1
  152 |         app.incement_namechanges(ctx.user.id) or {
  153 |             ctx.error('There was an error while updating the settings')
  154 |             return app.user_settings(username)
      |                        ~~~~~~~~~~~~~~~~~~~~~~~
  155 |         }
  156 |         app.rename_user_directory(username, new_username)
Details: have (string)
         want (&main.Context, string)
spytheman commented 1 week ago

It should compile cleanly now with latest V.