about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-06-28 18:21:57 +0200
committerAlan Pearce2024-06-28 18:22:39 +0200
commitcade05bffc5da4fa5b9ce1df93b4eb2abd246e73 (patch)
tree7cb27ae8d81697eec693a1e4d5966bc4a9bf7fad
parent313f62584d7e5b59b9322442d0ee07a7526a0324 (diff)
downloadwebsite-cade05bffc5da4fa5b9ce1df93b4eb2abd246e73.tar.lz
website-cade05bffc5da4fa5b9ce1df93b4eb2abd246e73.tar.zst
website-cade05bffc5da4fa5b9ce1df93b4eb2abd246e73.zip
use pointers for builder configuration
-rw-r--r--cmd/build/main.go4
-rw-r--r--internal/builder/builder.go2
-rw-r--r--internal/server/server.go4
3 files changed, 5 insertions, 5 deletions
diff --git a/cmd/build/main.go b/cmd/build/main.go
index d39ddf3..08bf10e 100644
--- a/cmd/build/main.go
+++ b/cmd/build/main.go
@@ -12,8 +12,8 @@ import (
 )
 
 func main() {
-	ioConfig := builder.IOConfig{}
-	if help, err := conf.Parse("", &ioConfig); err != nil {
+	ioConfig := &builder.IOConfig{}
+	if help, err := conf.Parse("", ioConfig); err != nil {
 		if errors.Is(err, conf.ErrHelpWanted) {
 			fmt.Println(help)
 			os.Exit(1)
diff --git a/internal/builder/builder.go b/internal/builder/builder.go
index 0bf6cb2..256d422 100644
--- a/internal/builder/builder.go
+++ b/internal/builder/builder.go
@@ -244,7 +244,7 @@ func build(outDir string, config *config.Config) (*Result, error) {
 	return r, nil
 }
 
-func BuildSite(ioConfig IOConfig, cfg *config.Config) (*Result, error) {
+func BuildSite(ioConfig *IOConfig, cfg *config.Config) (*Result, error) {
 	if cfg == nil {
 		var err error
 		cfg, err = config.GetConfig()
diff --git a/internal/server/server.go b/internal/server/server.go
index aa979f4..044b64f 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -107,7 +107,7 @@ func serverHeaderHandler(wrappedHandler http.Handler) http.Handler {
 	})
 }
 
-func rebuild(builderConfig builder.IOConfig, config *cfg.Config) error {
+func rebuild(builderConfig *builder.IOConfig, config *cfg.Config) error {
 	r, err := builder.BuildSite(builderConfig, config)
 	if err != nil {
 		return errors.WithMessage(err, "could not build site")
@@ -146,7 +146,7 @@ func New(runtimeConfig *Config) (*Server, error) {
 	listenAddress := net.JoinHostPort(runtimeConfig.ListenAddress, strconv.Itoa(runtimeConfig.Port))
 	top := http.NewServeMux()
 
-	builderConfig := builder.IOConfig{
+	builderConfig := &builder.IOConfig{
 		Source:      "content",
 		Destination: runtimeConfig.Root,
 		Development: runtimeConfig.Development,