From 67ed9df5ed90475a99059cd5136373d85fff6ce4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 00:24:23 +0300 Subject: cmd/gt: fix stale comments and remove dead LogWriter code - Fix package doc: reference 'internal' package (not 'cmd/gt/internal') - Remove unused LogWriter struct and its methods (never instantiated, repl.RunREPLWithLog passes *os.File directly as io.WriteCloser) - Remove now-unused 'io' import - Improve readStdin comment: clarify fallback truncates to 4096 bytes --- cmd/gt/main.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'cmd') diff --git a/cmd/gt/main.go b/cmd/gt/main.go index 647f70f..cc4d3e2 100644 --- a/cmd/gt/main.go +++ b/cmd/gt/main.go @@ -43,12 +43,11 @@ // - rpn/: Handles RPN expression parsing and evaluation // - repl/: Provides interactive Read-Eval-Print Loop mode // -// See the cmd/gt/internal package for version information. +// See the internal package for version information. package main import ( "fmt" - "io" "os" "strings" @@ -71,22 +70,6 @@ func main() { } } -// LogWriter wraps io.Writer for use with io.MultiWriter in REPL mode. -// It provides a log writer that can be passed to the REPL. -type LogWriter struct { - writer io.WriteCloser -} - -// Write writes data to the log file. -func (lw *LogWriter) Write(p []byte) (n int, err error) { - return lw.writer.Write(p) -} - -// Close closes the log file. -func (lw *LogWriter) Close() error { - return lw.writer.Close() -} - // runCommand processes command-line arguments and executes the appropriate action. // // It handles: @@ -170,6 +153,7 @@ func runCommand(args []string) (string, error) { } // readStdin reads all input from stdin and returns it as a string. +// Uses /dev/stdin for full reads; falls back to a single 4096-byte buffer if unavailable. func readStdin() (string, error) { data, err := os.ReadFile("/dev/stdin") if err != nil { -- cgit v1.2.3