Compare commits
No commits in common. "backup" and "main" have entirely different histories.
3 changed files with 0 additions and 40 deletions
|
@ -1,17 +0,0 @@
|
|||
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)
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module github.com/cotti/Guestbooky-backup
|
||||
|
||||
go 1.23.1
|
|
@ -1,20 +0,0 @@
|
|||
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
|
||||
}
|
Loading…
Reference in a new issue