~adnano/go-gemini-devel

go-gemini: tofu: Create path if not exists v1 APPLIED

Noah Kleiner: 1
 tofu: Create path if not exists

 1 files changed, 5 insertions(+), 0 deletions(-)
#454010 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~adnano/go-gemini-devel/patches/20869/mbox | git am -3
Learn more about email & git

[PATCH go-gemini] tofu: Create path if not exists Export this patch

This commit is a follow-up to 56774408 which does not take into account
the case that the parent directory of the known_hosts file does not already exist.
---
 tofu/tofu.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tofu/tofu.go b/tofu/tofu.go
index 6a7a15e..e2fcebb 100644
--- a/tofu/tofu.go
+++ b/tofu/tofu.go
@@ -10,6 +10,7 @@ import (
	"fmt"
	"io"
	"os"
	"path/filepath"
	"sort"
	"strings"
	"sync"
@@ -82,6 +83,10 @@ func (k *KnownHosts) WriteTo(w io.Writer) (int64, error) {

// Load loads the known hosts entries from the provided path.
func (k *KnownHosts) Load(path string) error {
	if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil {
		return err
	}

	f, err := os.OpenFile(path, os.O_CREATE|os.O_RDONLY, 0644)
	if err != nil {
		return err
-- 
2.28.0
Thanks!

To git.sr.ht:~adnano/go-gemini
   dea7600..3da7fe7  master -> master
go-gemini/patches/.build.yml: SUCCESS in 1m56s

[tofu: Create path if not exists][0] from [Noah Kleiner][1]

[0]: https://lists.sr.ht/~adnano/go-gemini-devel/patches/20869
[1]: mailto:noah@njkleiner.com

✓ #454010 SUCCESS go-gemini/patches/.build.yml https://builds.sr.ht/~adnano/job/454010