diff --git a/catalog_update.sh b/catalog_update.sh index fa8bc94..3ad25f0 100755 --- a/catalog_update.sh +++ b/catalog_update.sh @@ -1,4 +1,4 @@ #!/bin/bash -# go install golang.org/x/text/cmd/gotext@latest +go install golang.org/x/text/cmd/gotext@latest gotext update -out catalog.go \ No newline at end of file diff --git a/go.mod b/go.mod index 442d866..9ce28ce 100644 --- a/go.mod +++ b/go.mod @@ -1,18 +1,18 @@ module github.com/slytomcat/yd-go -go 1.21.6 +go 1.23.1 require ( - github.com/fsnotify/fsnotify v1.4.9 + github.com/fsnotify/fsnotify v1.7.0 github.com/godbus/dbus/v5 v5.1.0 github.com/slytomcat/systray v1.10.2 github.com/stretchr/testify v1.8.4 - golang.org/x/text v0.14.0 + golang.org/x/text v0.18.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.25.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 11aa746..2677e65 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -10,11 +10,10 @@ github.com/slytomcat/systray v1.10.2 h1:bXtf219eK6s/UbrShgN6EuZPDe5TsQ1TFZ1S0ete github.com/slytomcat/systray v1.10.2/go.mod h1:NZksLJ0MU7B6UNnrAadj4Qjn2EUrEMj1ZS0kmJw+N74= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/yd.go b/yd.go index 33b3038..ddbb65b 100644 --- a/yd.go +++ b/yd.go @@ -143,7 +143,7 @@ func onReady() { m.size2 = systray.AddMenuItem("", "") systray.AddSeparator() m.last = systray.AddMenuItem(msg.Sprintf("Last synchronized"), "") - for i := 0; i < 10; i++ { + for i := range 10 { m.lastMItem[i] = m.last.AddSubMenuItem("", "") } systray.AddSeparator() @@ -170,7 +170,7 @@ func onReady() { m.last.Disable() m.start.Hide() m.stop.Hide() - for i := 0; i < 10; i++ { + for i := range 10 { m.lastMItem[i].Hide() } if !notifyAvailable { // disable all menu items that are dependant on notification service diff --git a/ydisk/ydisk_bench_test.go b/ydisk/ydisk_bench_test.go index bbc7bbd..b77b8e2 100644 --- a/ydisk/ydisk_bench_test.go +++ b/ydisk/ydisk_bench_test.go @@ -17,7 +17,7 @@ func BenchmarkYDvalUpdateString(b *testing.B) { st1 := "Sync progress: 139.38 MB/ 139.38 MB (100 %)\nSynchronization core status: index\nPath to Yandex.Disk directory: '/home/stc/Yandex.Disk'\n\tTotal: 43.50 GB\n\tUsed: 2.89 GB\n\tAvailable: 40.61 GB\n\tMax file size: 50 GB\n\tTrash size: 0 B\n\nLast synchronized items:\n\tfile: 'NewFile'\n\tfile: 'File.ods'\n\tfile: 'downloads/file.deb'\n\tfile: 'downloads/setup'\n\tfile: 'download'\n\tfile: 'down'\n\tfile: 'do'\n\tfile: 'd'\n\tfile: 'o'\n\tfile: 'w'\n\n" //st2 := "Synchronization core status: idle\nPath to Yandex.Disk directory: '/home/stc/Yandex.Disk'\n\tTotal: 43.50 GB\n\tUsed: 2.89 GB\n\tAvailable: 40.61 GB\n\tMax file size: 50 GB\n\tTrash size: 0 B\n\nLast synchronized items:\n\tfile: 'File.ods'\n\tfile: 'downloads/file.deb'\n\tfile: 'downloads/setup'\n\tfile: 'download'\n\tfile: 'down'\n\tfile: 'do'\n\tfile: 'd'\n\tfile: 'o'\n\tfile: 'w'\n\tfile: 'n'\n\n" yd := newYDvals() - for i := 0; i < b.N; i++ { + for range b.N { yd.update(st1) } } @@ -25,7 +25,7 @@ func BenchmarkYDvalUpdatePreComp(b *testing.B) { st1 := "Sync progress: 139.38 MB/ 139.38 MB (100 %)\nSynchronization core status: index\nPath to Yandex.Disk directory: '/home/stc/Yandex.Disk'\n\tTotal: 43.50 GB\n\tUsed: 2.89 GB\n\tAvailable: 40.61 GB\n\tMax file size: 50 GB\n\tTrash size: 0 B\n\nLast synchronized items:\n\tfile: 'NewFile'\n\tfile: 'File.ods'\n\tfile: 'downloads/file.deb'\n\tfile: 'downloads/setup'\n\tfile: 'download'\n\tfile: 'down'\n\tfile: 'do'\n\tfile: 'd'\n\tfile: 'o'\n\tfile: 'w'\n\n" //st2 := "Synchronization core status: idle\nPath to Yandex.Disk directory: '/home/stc/Yandex.Disk'\n\tTotal: 43.50 GB\n\tUsed: 2.89 GB\n\tAvailable: 40.61 GB\n\tMax file size: 50 GB\n\tTrash size: 0 B\n\nLast synchronized items:\n\tfile: 'File.ods'\n\tfile: 'downloads/file.deb'\n\tfile: 'downloads/setup'\n\tfile: 'download'\n\tfile: 'down'\n\tfile: 'do'\n\tfile: 'd'\n\tfile: 'o'\n\tfile: 'w'\n\tfile: 'n'\n\n" yd := newYDvals() - for i := 0; i < b.N; i++ { + for range b.N { yd.update1(st1) } } @@ -34,7 +34,7 @@ func BenchmarkYDvalUpdateOrig(b *testing.B) { st1 := "Sync progress: 139.38 MB/ 139.38 MB (100 %)\nSynchronization core status: index\nPath to Yandex.Disk directory: '/home/stc/Yandex.Disk'\n\tTotal: 43.50 GB\n\tUsed: 2.89 GB\n\tAvailable: 40.61 GB\n\tMax file size: 50 GB\n\tTrash size: 0 B\n\nLast synchronized items:\n\tfile: 'NewFile'\n\tfile: 'File.ods'\n\tfile: 'downloads/file.deb'\n\tfile: 'downloads/setup'\n\tfile: 'download'\n\tfile: 'down'\n\tfile: 'do'\n\tfile: 'd'\n\tfile: 'o'\n\tfile: 'w'\n\n" //st2 := "Synchronization core status: idle\nPath to Yandex.Disk directory: '/home/stc/Yandex.Disk'\n\tTotal: 43.50 GB\n\tUsed: 2.89 GB\n\tAvailable: 40.61 GB\n\tMax file size: 50 GB\n\tTrash size: 0 B\n\nLast synchronized items:\n\tfile: 'File.ods'\n\tfile: 'downloads/file.deb'\n\tfile: 'downloads/setup'\n\tfile: 'download'\n\tfile: 'down'\n\tfile: 'do'\n\tfile: 'd'\n\tfile: 'o'\n\tfile: 'w'\n\tfile: 'n'\n\n" yd := newYDvals() - for i := 0; i < b.N; i++ { + for range b.N { yd.update2(st1) } } @@ -57,7 +57,7 @@ func BenchmarkYDvalUpdateOrig(b *testing.B) { // } // }() -// for i := 0; i < b.N; i++ { +// for range b.N { // st, err := exec.Command(SymExe, "status").Output() // if err != nil { // b.Fatal("simulation prepare error " + SymExe + err.Error()) @@ -86,7 +86,7 @@ func BenchmarkYDvalUpdateOrig(b *testing.B) { // } // }() -// for i := 0; i < b.N; i++ { +// for range b.N { // c := exec.Command(SymExe, "status") // var stdout bytes.Buffer // //stdout.Grow(256) @@ -100,7 +100,7 @@ func BenchmarkYDvalUpdateOrig(b *testing.B) { // } func BenchmarkEchoCmdOutput(b *testing.B) { - for i := 0; i < b.N; i++ { + for range b.N { st, err := exec.Command("echo", "test").Output() if err != nil || len(st) == 0 { b.Error(err) @@ -109,7 +109,7 @@ func BenchmarkEchoCmdOutput(b *testing.B) { } func BenchmarkEchoCmdOutput2(b *testing.B) { - for i := 0; i < b.N; i++ { + for range b.N { c := exec.Command("echo", "test") var stdout bytes.Buffer c.Stdout = &stdout @@ -122,7 +122,7 @@ func BenchmarkEchoCmdOutput2(b *testing.B) { } func BenchmarkSetChanged(b *testing.B) { - for i := 0; i < b.N; i++ { + for range b.N { a := "none" c := false setChanged(&a, "idle", &c) @@ -144,7 +144,7 @@ func setChanged1(v *string, val string, c *bool) { } func BenchmarkSetChanged1(b *testing.B) { - for i := 0; i < b.N; i++ { + for range b.N { a := "none" c := false setChanged1(&a, "idle", &c) diff --git a/ydisk/ydisk_test.go b/ydisk/ydisk_test.go index c9c1189..1d038da 100644 --- a/ydisk/ydisk_test.go +++ b/ydisk/ydisk_test.go @@ -41,7 +41,7 @@ func TestMain(m *testing.M) { SymExe, err = exec.LookPath("yandex-disk") if err != nil { - fmt.Print("yandex-disk utility lookup error:", err) + fmt.Println("yandex-disk utility lookup error:", err) os.Exit(1) }