From 4dc82515f444e900d45747ebfcef7112eaadc4d4 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Wed, 15 Feb 2023 16:24:07 +0100 Subject: [PATCH] chore: stop shadowing import names with variables --- src/agent/cli.v | 4 +-- src/console/aur/aur.v | 4 +-- src/console/logs/logs.v | 32 ++++++++++++------------ src/console/repos/repos.v | 10 ++++---- src/console/targets/targets.v | 46 +++++++++++++++++------------------ src/openssl.c.v | 5 ---- src/server/cli.v | 4 +-- src/server/server.v | 4 +-- 8 files changed, 52 insertions(+), 57 deletions(-) delete mode 100644 src/openssl.c.v diff --git a/src/agent/cli.v b/src/agent/cli.v index 41e3421..2dee8d6 100644 --- a/src/agent/cli.v +++ b/src/agent/cli.v @@ -23,9 +23,9 @@ pub fn cmd() cli.Command { description: 'Start an agent daemon.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! - agent(conf)! + agent(conf_)! } } } diff --git a/src/console/aur/aur.v b/src/console/aur/aur.v index 6fc8513..c1c409c 100644 --- a/src/console/aur/aur.v +++ b/src/console/aur/aur.v @@ -36,12 +36,12 @@ pub fn cmd() cli.Command { required_args: 2 execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! c := aur.new() pkgs := c.info(cmd.args[1..])! - vc := client.new(conf.address, conf.api_key) + vc := client.new(conf_.address, conf_.api_key) for pkg in pkgs { vc.add_target( diff --git a/src/console/logs/logs.v b/src/console/logs/logs.v index 518b507..b8e088c 100644 --- a/src/console/logs/logs.v +++ b/src/console/logs/logs.v @@ -74,7 +74,7 @@ pub fn cmd() cli.Command { ] execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! mut filter := BuildLogFilter{} @@ -146,7 +146,7 @@ pub fn cmd() cli.Command { raw := cmd.flags.get_bool('raw')! - list(conf, filter, raw)! + list(conf_, filter, raw)! } }, cli.Command{ @@ -156,9 +156,9 @@ pub fn cmd() cli.Command { description: 'Remove a build log that matches the given id.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! - remove(conf, cmd.args[0])! + remove(conf_, cmd.args[0])! } }, cli.Command{ @@ -168,10 +168,10 @@ pub fn cmd() cli.Command { description: 'Show all info for a specific build log.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! id := cmd.args[0].int() - info(conf, id)! + info(conf_, id)! } }, cli.Command{ @@ -181,10 +181,10 @@ pub fn cmd() cli.Command { description: 'Output the content of a build log to stdout.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! id := cmd.args[0].int() - content(conf, id)! + content(conf_, id)! } }, ] @@ -204,16 +204,16 @@ fn print_log_list(logs []BuildLog, raw bool) ! { } // list prints a list of all build logs. -fn list(conf Config, filter BuildLogFilter, raw bool) ! { - c := client.new(conf.address, conf.api_key) +fn list(conf_ Config, filter BuildLogFilter, raw bool) ! { + c := client.new(conf_.address, conf_.api_key) logs := c.get_build_logs(filter)! print_log_list(logs, raw)! } // info print the detailed info for a given build log. -fn info(conf Config, id int) ! { - c := client.new(conf.address, conf.api_key) +fn info(conf_ Config, id int) ! { + c := client.new(conf_.address, conf_.api_key) log := c.get_build_log(id)! print(log) @@ -221,15 +221,15 @@ fn info(conf Config, id int) ! { // content outputs the contents of the log file for a given build log to // stdout. -fn content(conf Config, id int) ! { - c := client.new(conf.address, conf.api_key) +fn content(conf_ Config, id int) ! { + c := client.new(conf_.address, conf_.api_key) content := c.get_build_log_content(id)! println(content) } // remove removes a build log from the server's list. -fn remove(conf Config, id string) ! { - c := client.new(conf.address, conf.api_key) +fn remove(conf_ Config, id string) ! { + c := client.new(conf_.address, conf_.api_key) c.remove_build_log(id.int())! } diff --git a/src/console/repos/repos.v b/src/console/repos/repos.v index 0021d52..3779d33 100644 --- a/src/console/repos/repos.v +++ b/src/console/repos/repos.v @@ -28,7 +28,7 @@ pub fn cmd() cli.Command { ] execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! if cmd.args.len < 3 { if !cmd.flags.get_bool('force')! { @@ -36,14 +36,14 @@ pub fn cmd() cli.Command { } } - client := client.new(conf.address, conf.api_key) + client_ := client.new(conf_.address, conf_.api_key) if cmd.args.len == 1 { - client.remove_repo(cmd.args[0])! + client_.remove_repo(cmd.args[0])! } else if cmd.args.len == 2 { - client.remove_arch_repo(cmd.args[0], cmd.args[1])! + client_.remove_arch_repo(cmd.args[0], cmd.args[1])! } else { - client.remove_package(cmd.args[0], cmd.args[1], cmd.args[2])! + client_.remove_package(cmd.args[0], cmd.args[1], cmd.args[2])! } } }, diff --git a/src/console/targets/targets.v b/src/console/targets/targets.v index 1b8d4be..d1dfbe3 100644 --- a/src/console/targets/targets.v +++ b/src/console/targets/targets.v @@ -54,7 +54,7 @@ pub fn cmd() cli.Command { ] execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! mut filter := TargetFilter{} @@ -85,7 +85,7 @@ pub fn cmd() cli.Command { raw := cmd.flags.get_bool('raw')! - list(conf, filter, raw)! + list(conf_, filter, raw)! } }, cli.Command{ @@ -113,7 +113,7 @@ pub fn cmd() cli.Command { ] execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! t := NewTarget{ kind: cmd.flags.get_string('kind')! @@ -125,7 +125,7 @@ pub fn cmd() cli.Command { raw := cmd.flags.get_bool('raw')! - add(conf, t, raw)! + add(conf_, t, raw)! } }, cli.Command{ @@ -135,9 +135,9 @@ pub fn cmd() cli.Command { description: 'Remove a target that matches the given id.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! - remove(conf, cmd.args[0])! + remove(conf_, cmd.args[0])! } }, cli.Command{ @@ -147,9 +147,9 @@ pub fn cmd() cli.Command { description: 'Show detailed information for the target matching the id.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! - info(conf, cmd.args[0])! + info(conf_, cmd.args[0])! } }, cli.Command{ @@ -196,7 +196,7 @@ pub fn cmd() cli.Command { ] execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! found := cmd.flags.get_all_found() @@ -208,7 +208,7 @@ pub fn cmd() cli.Command { } } - patch(conf, cmd.args[0], params)! + patch(conf_, cmd.args[0], params)! } }, cli.Command{ @@ -235,7 +235,7 @@ pub fn cmd() cli.Command { ] execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! remote := cmd.flags.get_bool('remote')! force := cmd.flags.get_bool('force')! @@ -248,10 +248,10 @@ pub fn cmd() cli.Command { return error('When scheduling the build remotely, you have to specify an architecture.') } - c := client.new(conf.address, conf.api_key) + c := client.new(conf_.address, conf_.api_key) c.queue_job(target_id, arch, force)! } else { - build(conf, target_id, force)! + build(conf_, target_id, force)! } } }, @@ -260,8 +260,8 @@ pub fn cmd() cli.Command { } // list prints out a list of all repositories. -fn list(conf Config, filter TargetFilter, raw bool) ! { - c := client.new(conf.address, conf.api_key) +fn list(conf_ Config, filter TargetFilter, raw bool) ! { + c := client.new(conf_.address, conf_.api_key) targets := c.get_targets(filter)! data := targets.map([it.id.str(), it.kind, it.url, it.repo]) @@ -273,8 +273,8 @@ fn list(conf Config, filter TargetFilter, raw bool) ! { } // add adds a new target to the server's list. -fn add(conf Config, t &NewTarget, raw bool) ! { - c := client.new(conf.address, conf.api_key) +fn add(conf_ Config, t &NewTarget, raw bool) ! { + c := client.new(conf_.address, conf_.api_key) target_id := c.add_target(t)! if raw { @@ -285,13 +285,13 @@ fn add(conf Config, t &NewTarget, raw bool) ! { } // remove removes a target from the server's list. -fn remove(conf Config, id string) ! { - c := client.new(conf.address, conf.api_key) +fn remove(conf_ Config, id string) ! { + c := client.new(conf_.address, conf_.api_key) c.remove_target(id.int())! } // patch patches a given target with the provided params. -fn patch(conf Config, id string, params map[string]string) ! { +fn patch(conf_ Config, id string, params map[string]string) ! { // We check the cron expression first because it's useless to send an // invalid one to the server. if 'schedule' in params && params['schedule'] != '' { @@ -300,13 +300,13 @@ fn patch(conf Config, id string, params map[string]string) ! { } } - c := client.new(conf.address, conf.api_key) + c := client.new(conf_.address, conf_.api_key) c.patch_target(id.int(), params)! } // info shows detailed information for a given target. -fn info(conf Config, id string) ! { - c := client.new(conf.address, conf.api_key) +fn info(conf_ Config, id string) ! { + c := client.new(conf_.address, conf_.api_key) target := c.get_target(id.int())! println(target) } diff --git a/src/openssl.c.v b/src/openssl.c.v deleted file mode 100644 index bff8c54..0000000 --- a/src/openssl.c.v +++ /dev/null @@ -1,5 +0,0 @@ -// With V 0.3.3, Vieter fails to compile without this fix, as provided by -// spytheman. It will get fixed in V itself, but this temporary fix allows me -// to stay on V 0.3.3. -[typedef] -pub struct C.SSL_CTX{} diff --git a/src/server/cli.v b/src/server/cli.v index c272d52..08ad5f8 100644 --- a/src/server/cli.v +++ b/src/server/cli.v @@ -25,9 +25,9 @@ pub fn cmd() cli.Command { description: 'Start the Vieter server.' execute: fn (cmd cli.Command) ! { config_file := cmd.flags.get_string('config-file')! - conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! + conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)! - server(conf)! + server(conf_)! } } } diff --git a/src/server/server.v b/src/server/server.v index e1fa0d7..4cccb27 100644 --- a/src/server/server.v +++ b/src/server/server.v @@ -82,7 +82,7 @@ pub fn server(conf Config) ! { repo_dir := os.join_path_single(conf.data_dir, server.repo_dir_name) // This also creates the directories if needed - repo := repo.new(repo_dir, conf.pkg_dir, conf.default_arch) or { + repo_ := repo.new(repo_dir, conf.pkg_dir, conf.default_arch) or { logger.error(err.msg()) exit(1) } @@ -105,7 +105,7 @@ pub fn server(conf Config) ! { logger: logger api_key: conf.api_key conf: conf - repo: repo + repo: repo_ db: db collector: collector job_queue: build.new_job_queue(global_ce, conf.base_image)