From 337b234db58b3893f11deac7b140240b16ba1d5d Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 2 Jun 2025 14:59:11 +0300 Subject: [PATCH] =?utf8?q?txtar=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit https://pkg.go.dev/golang.org/x/exp/cmd/txtar Давно видел в Go коде упоминание txtar формата архивов. Недавно вот использовал в одном месте, где надо множество текстовых файлов записать, но не хочется возиться с работой с ФС, а просто выплюнуть текст в stdout, который уже в txtar утилиту перенаправить. go doc golang.org/x/tools/txtar Package txtar implements a trivial text-based file archive format. The goals for the format are: - be trivial enough to create and edit by hand. - be able to store trees of text files describing go command test cases. - diff nicely in git history and code reviews. Non-goals include being a completely general archive format, storing binary data, storing file modes, storing special files like symbolic links, and so on. # Txtar format A txtar archive is zero or more comment lines and then a sequence of file entries. Each file entry begins with a file marker line of the form "-- FILENAME --" and is followed by zero or more file content lines making up the file data. The comment or file content ends at the next file marker line. The file marker line must begin with the three-byte sequence "-- " and end with the three-byte sequence " --", but the enclosed file name can be surrounding by additional white space, all of which is stripped. If the txtar file is missing a trailing newline on the final line, parsers should consider a final newline to be present anyway. There are no possible syntax errors in a txtar archive. -- 2.51.0