Skip to content

Commit f10a974

Browse files
authored
feat: upgrade go version (#220)
upgrade GH runner
1 parent 919e7fe commit f10a974

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.github/workflows/pullRequestAndMergeMaster.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
name: CreateAndPushWindowsExecutable
1111
strategy:
1212
matrix:
13-
go: [ 1.22.7 ]
13+
go: [ 1.24.6 ]
1414
goarch: [ amd64 ]
15-
runs-on: windows-2019
15+
runs-on: windows-2022
1616
steps:
1717
- uses: actions/setup-go@v2
1818
with:

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
name: CreateAndPushWindowsExecutable
99
strategy:
1010
matrix:
11-
go: [ 1.22.7 ]
11+
go: [ 1.24.6 ]
1212
goarch: [ amd64 ]
13-
runs-on: windows-2019
13+
runs-on: windows-2022
1414
steps:
1515
- uses: actions/setup-go@v2
1616
with:

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/newrelic/nri-winservices
22

3-
go 1.22.7
3+
go 1.24.6
44

55
require (
66
github.com/newrelic/infra-integrations-sdk/v4 v4.2.1
@@ -9,7 +9,7 @@ require (
99
github.com/prometheus/common v0.55.0
1010
github.com/stretchr/testify v1.9.0
1111
github.com/xeipuuv/gojsonschema v1.2.0
12-
golang.org/x/sys v0.22.0
12+
golang.org/x/sys v0.33.0
1313
gopkg.in/yaml.v2 v2.4.0
1414
)
1515

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,8 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc
951951
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
952952
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
953953
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
954-
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
955-
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
954+
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
955+
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
956956
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
957957
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
958958
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

src/exporter/exporter.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ func (e *Exporter) handle() (windows.Handle, error) {
151151
return processHandle, fmt.Errorf("process cannot be nil pointer")
152152
}
153153

154-
// Using unsafe operation we are using the handle inside os.Process.
155-
processHandle = (*struct {
156-
pid int
157-
handle windows.Handle
158-
})(unsafe.Pointer(e.cmd.Process)).handle
154+
const access = windows.PROCESS_SET_QUOTA | windows.PROCESS_TERMINATE
155+
processHandle, err := windows.OpenProcess(access, false, uint32(e.cmd.Process.Pid)) //nolint:gosec
156+
157+
if err != nil {
158+
return 0, fmt.Errorf("open process failed : %w", err)
159+
}
159160

160161
return processHandle, nil
161162
}

0 commit comments

Comments
 (0)