Skip to content

Commit aba1269

Browse files
committed
Migrate to go-ole fork with fixed memory leaks
We can't use a replace trick in a library, so we have to replace original go-ole with the forked one, until the fixes will be merged: - go-ole/go-ole#199 - go-ole/go-ole#201
1 parent 25b2c94 commit aba1269

8 files changed

+26
-16
lines changed

connection.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"reflect"
99
"sync"
1010

11-
"github.com/go-ole/go-ole"
12-
"github.com/go-ole/go-ole/oleutil"
11+
"github.com/bi-zone/go-ole"
12+
"github.com/bi-zone/go-ole/oleutil"
1313
"github.com/hashicorp/go-multierror"
1414
"github.com/scjalliance/comshim"
1515
)

decoder.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"strings"
1111
"time"
1212

13-
"github.com/go-ole/go-ole"
14-
"github.com/go-ole/go-ole/oleutil"
13+
"github.com/bi-zone/go-ole"
14+
"github.com/bi-zone/go-ole/oleutil"
1515
"github.com/hashicorp/go-multierror"
1616
)
1717

decoder_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"testing"
1010
"time"
1111

12-
"github.com/go-ole/go-ole"
12+
"github.com/bi-zone/go-ole"
1313
)
1414

1515
var (

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module github.com/bi-zone/wmi
22

33
require (
4-
github.com/go-ole/go-ole v1.2.2
4+
github.com/bi-zone/go-ole v1.2.5
5+
github.com/go-ole/go-ole v1.2.4 // indirect
56
github.com/hashicorp/go-multierror v1.0.0
67
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e
8+
golang.org/x/sys v0.0.0-20200806060901-a37d78b92225
79
)
8-
9-
replace github.com/go-ole/go-ole => github.com/bi-zone/go-ole v1.2.5-0.20200615091707-5a6c01d333ed

go.sum

100644100755
+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
github.com/bi-zone/go-ole v1.2.5-0.20200615091707-5a6c01d333ed h1:FR6GKPbTPKkA0FrTw0e26gU3AM5Ov75FgEUIwaggGxo=
2-
github.com/bi-zone/go-ole v1.2.5-0.20200615091707-5a6c01d333ed/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
1+
github.com/bi-zone/go-ole v1.2.5 h1:/4G2KrTbq1e3FsMkd40quzwIrLb4QdxZJnUUlG7UjcM=
2+
github.com/bi-zone/go-ole v1.2.5/go.mod h1:BxzT498d9QAq10L6G/pTMscpDzqnpKN6DUBbmFKwyQY=
3+
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
4+
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
5+
github.com/gonuts/commander v0.1.0/go.mod h1:qkb5mSlcWodYgo7vs8ulLnXhfinhZsZcm6+H/z1JjgY=
6+
github.com/gonuts/flag v0.1.0/go.mod h1:ZTmTGtrSPejTo/SRNhCqwLTmiAgyBdCkLYhHrAoBdz4=
37
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
48
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
59
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
@@ -8,3 +12,5 @@ github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e h1:+/AzLkOdIXE
812
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e/go.mod h1:9Tc1SKnfACJb9N7cw2eyuI6xzy845G7uZONBsi5uPEA=
913
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo=
1014
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
15+
golang.org/x/sys v0.0.0-20200806060901-a37d78b92225 h1:a5kp7Ohh+lqGCGHUBQdPwGHTJXKNhVVWp34F+ncDC9M=
16+
golang.org/x/sys v0.0.0-20200806060901-a37d78b92225/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

memory_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"testing"
1111
"time"
1212

13-
"github.com/go-ole/go-ole"
14-
"github.com/go-ole/go-ole/oleutil"
13+
"github.com/bi-zone/go-ole"
14+
"github.com/bi-zone/go-ole/oleutil"
1515
"github.com/scjalliance/comshim"
1616
)
1717

@@ -151,6 +151,10 @@ func TestMemory_WMIConcurrent(t *testing.T) {
151151
//
152152
// Run using: `TEST_MEM=1 go test -run TestMemory_OLEErrors -timeout 60m`
153153
func TestMemory_OLEErrors(t *testing.T) {
154+
if os.Getenv("TEST_MEM") == "" {
155+
t.Skip("Skipping TestMemory_OLEErrors; $TEST_MEM is not set")
156+
}
157+
154158
// Subscribe to some rare event. E.g. removal of the local drive.
155159
const query = "SELECT * FROM Win32_VolumeChangeEvent WHERE EventType=3"
156160

notification_query.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"sync"
1010
"time"
1111

12-
"github.com/go-ole/go-ole"
13-
"github.com/go-ole/go-ole/oleutil"
12+
"github.com/bi-zone/go-ole"
13+
"github.com/bi-zone/go-ole/oleutil"
1414
"github.com/hashicorp/go-multierror"
1515
"github.com/scjalliance/comshim"
1616
)

swbemservices.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"fmt"
77
"sync"
88

9-
"github.com/go-ole/go-ole"
10-
"github.com/go-ole/go-ole/oleutil"
9+
"github.com/bi-zone/go-ole"
10+
"github.com/bi-zone/go-ole/oleutil"
1111
"github.com/hashicorp/go-multierror"
1212
"github.com/scjalliance/comshim"
1313
)

0 commit comments

Comments
 (0)