Skip to content

Commit

Permalink
Merge pull request #41 from slytomcat/dev
Browse files Browse the repository at this point in the history
Update go and dependencies versions
  • Loading branch information
slytomcat authored Sep 30, 2024
2 parents f8c30fb + 2480180 commit 71ac222
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion catalog_update.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
13 changes: 6 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand All @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions yd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions ydisk/ydisk_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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)
}
}
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)
}
}
Expand All @@ -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)
}
}
Expand All @@ -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())
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ydisk/ydisk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 71ac222

Please sign in to comment.