summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 00:24:23 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 00:24:23 +0300
commit67ed9df5ed90475a99059cd5136373d85fff6ce4 (patch)
tree476d20e8b2127aa4eff8e9ac840d36652e92982b /cmd
parentd334ad95fb3413d15549960a0c3c1c4739ae5055 (diff)
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
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gt/main.go20
1 files changed, 2 insertions, 18 deletions
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 {