Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
140 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
debug | ||
DeleteArchivedBackups.exe | ||
testdata/files/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// package main leaves recent backups only. It doesn't delete last backup files. | ||
|
||
package main | ||
|
||
import ( | ||
"bytes" | ||
"io/ioutil" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func Test_main(t *testing.T) { | ||
main() | ||
} | ||
|
||
func TestMainParamExample(t *testing.T) { | ||
printExample = true | ||
oldstdout := os.Stdout | ||
name := "./testdata/config.json" | ||
f, err := os.OpenFile(name, os.O_CREATE, 0) | ||
if err != nil { | ||
t.Errorf("%s", err) | ||
return | ||
} | ||
os.Stdout = f | ||
defer func() { os.Stdout = oldstdout }() | ||
|
||
main() | ||
|
||
os.Stdout = oldstdout | ||
_ = f.Close() | ||
f, err = os.Open(name) | ||
if err != nil { | ||
t.Error(err) | ||
return | ||
} | ||
b, err := ioutil.ReadAll(f) | ||
if err != nil { | ||
t.Error(err) | ||
return | ||
} | ||
if !bytes.Equal(b, []byte(exampleconf+"\n")) { // \n was added with fmt.Println() | ||
t.Errorf("not equal\n want %v\n got %v\n", []byte(exampleconf), b) | ||
return | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/zavla/deleteArchivedBackups | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/zavla/dblist/v3 v3.0.0 | ||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d // indirect | ||
) | ||
|
||
// fo development only replace github.com/zavla/dblist/v3 v3.0.0-20200221165736-a44997e2237c => d:/za/zavlagopath/dblist/v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518 h1:iD+PFTQwKEmbwSdwfvP5ld2WEI/g7qbdhmHJ2ASfYGs= | ||
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A= | ||
github.com/zavla/dblist v2.0.1+incompatible h1:yVQeaovcNs4SZgTtWSV535gC3uteSWKyS6k1U/hqMWE= | ||
github.com/zavla/dblist/v2 v2.0.1 h1:uZs4IJRzXfpui3hAci5b/BPcxQuh8MYvgvNkiFBVZvc= | ||
github.com/zavla/dblist/v2 v2.0.1/go.mod h1:IA1N3nX+DcTO2k24vQ7SFAILspeQp7e8dwY4o7Is2EA= | ||
github.com/zavla/dblist/v3 v3.0.0-20200221165736-a44997e2237c h1:dJGpf51noguoaIS8XmlVXX6sA/+PeRgMv/94ZyYde0Y= | ||
github.com/zavla/dblist/v3 v3.0.0-20200221165736-a44997e2237c/go.mod h1:txBAtQRvDEgwboFq/d6Fsx1zEYNfCFQEIOG0G8lrUz0= | ||
github.com/zavla/dblist/v3 v3.0.0 h1:k+5baX8NflR9R+Yky/OYACthQHHu+xakwwUR7abb0bE= | ||
github.com/zavla/dblist/v3 v3.0.0/go.mod h1:50zyWn745NnNN3Uj4/sBK0oMFSZ4DhSAb+0Fta1jdLY= | ||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= | ||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ixkcwXThoiF6yf+R9scA= | ||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
[ | ||
{"path":"j:/b", "Filename":"BC_Cold", "suffix":"-differ.dif","Days":1}, | ||
{"path":"j:/b", "Filename":"нашипост", "suffix":"-FULL.bak","Days":5}, | ||
{"path":"j:/b", "Filename":"from_84_Dirs", "suffix":".rar","Days":7}, | ||
{"path":"g:/Shebb", "Filename":"buh_canvest", "suffix":"-differ.rar","Days":1}, | ||
{"path":"g:/Shebb", "Filename":"buh_canvest", "suffix":"-FULL.rar","Days":1} | ||
] | ||
|
||
[ | ||
{"path":"./testdata/files", "Filename":"E08", "suffix":"-FULL.bak", "Days":2}, | ||
{"path":"./testdata/files", "Filename":"A2", "suffix":"-FULL.bak", "Days":10}, | ||
{"path":"./testdata/files", "Filename":"A2", "suffix":"-differ.dif", "Days":1}, | ||
{"path":"./testdata/files/bases116", "Filename":"dbase1", "suffix":"-FULL.bak", "Days":5}, | ||
{"path":"./testdata/files/bases116", "Filename":"dbase1", "suffix":"-differ.dif", "Days":1} | ||
] | ||
|