Backup capabilities using a S3-compatible API. #2

Merged
cotti merged 2 commits from backup into main 2025-01-27 05:29:01 +01:00
3 changed files with 40 additions and 0 deletions
Showing only changes of commit b8ae6e364a - Show all commits

View file

@ -0,0 +1,17 @@
package main
import (
"fmt"
"os"
"github.com/cotti/Guestbooky-backup/internal/compactor"
)
func main() {
err := compactor.Compact(os.Args[1], os.Args[2])
if err != nil {
fmt.Println("An error occurred while compacting:", err.Error())
os.Exit(1)
}
os.Exit(0)
}

View file

@ -0,0 +1,3 @@
module github.com/cotti/Guestbooky-backup
go 1.23.1

View file

@ -0,0 +1,20 @@
package compactor
import (
"errors"
"fmt"
"io/fs"
"os"
)
func Compact(source, destination string) error {
fmt.Println(
"Compacting", source, "to", destination,
)
if _, err := os.Stat(source); errors.Is(err, fs.ErrNotExist) {
return errors.New("source file does not exist")
}
return nil
}