all repos — website @ cade05bffc5da4fa5b9ce1df93b4eb2abd246e73

My website

use pointers for builder configuration
Alan Pearce alan@alanpearce.eu
Fri, 28 Jun 2024 18:21:57 +0200
commit

cade05bffc5da4fa5b9ce1df93b4eb2abd246e73

parent

313f62584d7e5b59b9322442d0ee07a7526a0324

3 files changed, 5 insertions(+), 5 deletions(-)

jump to
M cmd/build/main.gocmd/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.gointernal/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.gointernal/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,