From 0fe17392bbfeee4a0e12d824493fbcd1442170b8 Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Fri, 16 Jan 2026 14:53:35 -0600
Subject: [PATCH] talk: finish pres and yt script
---
.../functional_options_pattern_in_go/index.md | 216 ++++++++++++++++++
.../script.md | 148 ++++++++++++
2 files changed, 364 insertions(+)
create mode 100644 slides/functional_options_pattern_in_go/index.md
create mode 100644 slides/functional_options_pattern_in_go/script.md
diff --git a/slides/functional_options_pattern_in_go/index.md b/slides/functional_options_pattern_in_go/index.md
new file mode 100644
index 0000000..e997140
--- /dev/null
+++ b/slides/functional_options_pattern_in_go/index.md
@@ -0,0 +1,216 @@
+---
+theme: default
+layout: center
+class: text-center
+fonts:
+ sans: "CaskaydiaCove Nerd Font Mono"
+---
+
+# A Trick for Designing
Friendly APIs in Go
+
+---
+layout: center
+---
+
+# The Optional Configuration Problem
+
+```go
+// No defaults?
+// What is sensible?
+// What does 'true' do?
+// What is '30'?
+srv := NewServer("localhost", 8080, 30, true)
+```
+
+---
+layout: center
+---
+
+# "We need to add a TLS parameter."
+
+```go
+func NewServer(host string, port int, timeout int) *Server {
+ // ...
+}
+```
+
+---
+layout: center
+---
+
+# "Just use a struct"
+
+```go
+srv := NewServer(Config{
+ Host: "localhost",
+ Port: 0,
+})
+```
+
+---
+layout: center
+class: text-center
+---
+
+# "Nah bro, use functional options."
+
+---
+layout: center
+---
+
+# 1. Define the option
+
+```go
+type Server struct {
+ host string
+ port int
+}
+
+// Option is a function that modifies the Server
+type Option func(*Server)
+```
+
+---
+layout: center
+---
+
+# 2. Create closures
+
+```go
+// WithPort captures the 'port' value
+func WithPort(port int) Option {
+ // It returns a closure
+ return func(s *Server) {
+ s.port = port
+ }
+}
+
+func WithHost(h string) Option {
+ return func(s *Server) {
+ s.host = h
+ }
+}
+```
+
+---
+layout: center
+class: text-center
+---
+
+# 3. Get variadic
+
+