use pointers for builder configuration
Alan Pearce alan@alanpearce.eu
Fri, 28 Jun 2024 18:21:57 +0200
3 files changed, 5 insertions(+), 5 deletions(-)
M cmd/build/main.go → cmd/build/main.go
@@ -12,8 +12,8 @@ "github.com/pkg/errors" ) 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)
M internal/builder/builder.go → internal/builder/builder.go
@@ -244,7 +244,7 @@ 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()
M internal/server/server.go → internal/server/server.go
@@ -107,7 +107,7 @@ wrappedHandler.ServeHTTP(w, r) }) } -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 @@ 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,