From 941f138934d5f674f14a1ec631ec6d051d8f2033 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 18 Oct 2020 13:46:30 +0300 Subject: [PATCH] vfmt: use rand.ulid() for the worker file name (make `v test-fmt` more robust) --- cmd/tools/vfmt.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/tools/vfmt.v b/cmd/tools/vfmt.v index 25f1742b33..87be6dc6f7 100644 --- a/cmd/tools/vfmt.v +++ b/cmd/tools/vfmt.v @@ -5,6 +5,7 @@ module main import os import os.cmdline +import rand import v.ast import v.pref import v.fmt @@ -166,7 +167,8 @@ fn (foptions &FormatOptions) format_file(file string) { // checker.check(file_ast) formatted_content := fmt.fmt(file_ast, table, foptions.is_debug) file_name := os.file_name(file) - vfmt_output_path := os.join_path(os.temp_dir(), 'vfmt_' + file_name) + ulid := rand.ulid() + vfmt_output_path := os.join_path(os.temp_dir(), 'vfmt_${ulid}_$file_name') os.write_file(vfmt_output_path, formatted_content) if foptions.is_verbose { eprintln('fmt.fmt worked and $formatted_content.len bytes were written to $vfmt_output_path .')