Add a basic README
- ID
715a271- date
2025-09-28 21:21:54+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
542f254- message
Add a basic README- changed files
1 file, 38 additions
Changed files
README.md (0) → README.md (572)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..84170e0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,38 @@
+# q.go
+
+This is a Go function for print debugging, where all the printed statements go to a dedicated file.
+
+```go
+package main
+
+import (
+ "github.com/alexwlchan/q"
+ "os"
+)
+
+func printShapeInfo(name string, sides int) {
+ q.Q("a %s has %d sides", name, sides)
+}
+
+func main() {
+ q.Q("hello world")
+
+ q.Q(2 + 2)
+
+ _, err := os.Stat("does_not_exist.txt")
+ q.Q(err)
+
+ printShapeInfo("triangle", 3)
+}
+```
+
+```console
+$ cat /tmp/q.txt
+main: "hello world"
+
+main: 2 + 2 = 4
+
+main: err = stat does_not_exist.txt: no such file or directory
+
+printShapeInfo: a triangle has 3 sides
+```
\ No newline at end of file