From 3a6effad807b5bd7b0acd9c97699555ad1f3dffa Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Fri, 1 Apr 2022 21:34:58 +0200 Subject: [PATCH] Ran vfmt --- src/server/git.v | 13 +++++++------ src/server/response.v | 6 +++--- src/web/web.v | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/server/git.v b/src/server/git.v index 52cd262..8862af8 100644 --- a/src/server/git.v +++ b/src/server/git.v @@ -9,12 +9,12 @@ import net.http pub struct GitRepo { pub mut: // URL of the Git repository - url string + url string // Branch of the Git repository to use branch string // On which architectures the package is allowed to be built. In reality, // this controls which builders will periodically build the image. - arch []string + arch []string } fn (mut r GitRepo) patch_from_params(params map[string]string) { @@ -22,8 +22,8 @@ fn (mut r GitRepo) patch_from_params(params map[string]string) { if field.name in params { $if field.typ is string { r.$(field.name) = params[field.name] - // This specific type check is needed for the compiler to ensure - // our types are correct + // This specific type check is needed for the compiler to ensure + // our types are correct } $else $if field.typ is []string { r.$(field.name) = params[field.name].split(',') } @@ -41,7 +41,6 @@ fn repo_from_params(params map[string]string) ?GitRepo { return error('Missing parameter: ${field.name}.') } } - repo.patch_from_params(params) return repo @@ -146,7 +145,9 @@ fn (mut app App) post_repo() web.Result { repos[id] = new_repo lock app.git_mutex { - write_repos(app.conf.repos_file, &repos) or { return app.status(http.Status.internal_server_error) } + write_repos(app.conf.repos_file, &repos) or { + return app.status(http.Status.internal_server_error) + } } return app.json(http.Status.ok, new_response('Repo added successfully.')) diff --git a/src/server/response.v b/src/server/response.v index 376493f..354e7da 100644 --- a/src/server/response.v +++ b/src/server/response.v @@ -2,19 +2,19 @@ module server struct Response { message string - data T + data T } fn new_response(message string) Response { return Response{ message: message - data: "" + data: '' } } fn new_data_response(data T) Response { return Response{ - message: "" + message: '' data: data } } diff --git a/src/web/web.v b/src/web/web.v index 6e07aea..eb8d5df 100644 --- a/src/web/web.v +++ b/src/web/web.v @@ -138,8 +138,8 @@ pub const ( // It has fields for the query, form, files. pub struct Context { mut: - content_type string = 'text/plain' - status http.Status = http.Status.ok + content_type string = 'text/plain' + status http.Status = http.Status.ok pub: // HTTP Request req http.Request