From c03f99ade69eaa26d46a4820c79d6188866a7031 Mon Sep 17 00:00:00 2001 From: M0Rf30 Date: Mon, 7 Aug 2023 18:46:02 +0200 Subject: [PATCH] chore: general cleanup --- debian/debian.go | 1 - pkgbuild/pkgbuild.go | 2 -- utils/utils.go | 9 +-------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/debian/debian.go b/debian/debian.go index d105f5e..97cfede 100644 --- a/debian/debian.go +++ b/debian/debian.go @@ -19,7 +19,6 @@ import ( type Debian struct { debDir string PKGBUILD *pkgbuild.PKGBUILD - // sums string } func (d *Debian) getArch() { diff --git a/pkgbuild/pkgbuild.go b/pkgbuild/pkgbuild.go index 69a4e59..b1041b7 100644 --- a/pkgbuild/pkgbuild.go +++ b/pkgbuild/pkgbuild.go @@ -278,9 +278,7 @@ func (p *PKGBUILD) CreateSpec(filePath string, script string) error { log.Panic(err) } - // remember to close the file defer file.Close() - // create new buffer writer := io.Writer(file) tmpl := template.New("template") diff --git a/utils/utils.go b/utils/utils.go index ac6c2c2..eb6eadb 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -180,19 +180,12 @@ func Unarchive(archiveReader io.Reader, destination string) error { return os.MkdirAll(newPath, archiveFile.Mode()) } - // check if we've seen the dir before, if not, we'll attempt to create - // it in case its not there. This needs to be done as archive formats - // do not necessarily always have the directory in order/present - // eg zip dirs for quarto definitely are missing seemingly random dirs - // when talking with charles about it, we were both unsure what might - // be the reason, and assume its probably the powershell compress-archive - // encantation, so rather than trying to go down that rabbit hole too far, - // some additional checking here fileDir := filepath.Dir(newPath) _, seenDir := dirMap[fileDir] if !seenDir { dirMap[fileDir] = true + // linux default for new directories is 777 and let the umask handle // if should have other controls err = os.MkdirAll(fileDir, 0777)