1
0
mirror of https://github.com/google/gops.git synced 2024-11-19 20:31:58 +02:00
Commit Graph

286 Commits

Author SHA1 Message Date
dependabot[bot]
14342869be build(deps): bump golang.org/x/sys from 0.5.0 to 0.6.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-07 09:32:18 +01:00
dependabot[bot]
8321946999 build(deps): bump github.com/shirou/gopsutil/v3 from 3.23.1 to 3.23.2
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.1 to 3.23.2.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.23.1...v3.23.2)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-03 11:50:53 +01:00
Tobias Klauser
70408a1556 Update CI to Go 1.20 2023-02-10 14:25:28 +01:00
segevda
a241038823
replace ioutil usages with io and os (#202)
ioutil was deprecated in go1.16 and its functions now directly call io
and os functions. It is recommended to use these implementations in new
code.
2023-02-10 14:03:23 +01:00
segevda
dbeb29cd3e
cmd/shared: add 'off' option to setgc (#201)
To stop GC completely, debug.SetGCPercentage needs to receive a negative
integer. Passing a negative integer is cumbersome:
$ gops setgc <pid> -- -1

This commit adds a more user-friendly way to achieve that:
$ gops setgc <pid> off

This behavior is aligned with that of the GOGC env variable, where
negative or "off" can be set to stop the GC.
2023-02-10 11:24:10 +01:00
dependabot[bot]
2b6817995c build(deps): bump golang.org/x/sys from 0.4.0 to 0.5.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-07 23:51:36 +01:00
dependabot[bot]
524040e551 build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.12 to 3.23.1
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.12 to 3.23.1.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.12...v3.23.1)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-01 23:21:19 +01:00
Tobias Klauser
52a0828960 internal: remove redundant environment variable checks in ConfigDir
os.UserConfigDir will already check the AppData environment variable on
Windows (environment variable names are case-insensitive on Windows):
https://cs.opensource.google/go/go/+/release-branch.go1.19:src/os/file.go;l=461-465
and the XDG_CONFIG_HOME environment variable on Unix operating systems:
https://cs.opensource.google/go/go/+/release-branch.go1.19:src/os/file.go;l=481-489
2023-01-31 14:45:20 +01:00
dependabot[bot]
b4db245b1a build(deps): bump golang.org/x/sys from 0.3.0 to 0.4.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-04 22:07:17 +01:00
dependabot[bot]
b83b19ead3 build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.11 to 3.22.12
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.11 to 3.22.12.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/commits/v3.22.12)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-03 15:58:33 +01:00
dependabot[bot]
50c4123411 build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.10 to 3.22.11
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.10 to 3.22.11.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/commits)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 13:48:55 +01:00
Tobias Klauser
019dbd09a0 go.mod: downgrade github.com/shirou/gopsutil to v3.22.10
dependabot updated gopsutil to v3.22.11 in PR #189. That tag is no
longer available upstream and was retracted, see shirou/gopsutil#1386.
Switch back to the previous version for now and let dependabot update
once there is a new version.

Fixes #191
2022-12-15 11:00:02 +01:00
dependabot[bot]
2531148669 build(deps): bump golang.org/x/sys from 0.2.0 to 0.3.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 16:51:24 +01:00
dependabot[bot]
9430031e1a build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.10 to 3.22.11
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.10 to 3.22.11.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/commits)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-07 09:20:32 +01:00
Tobias Klauser
fc3d8acb6d go.mod: bump to Go 1.17 2022-12-07 09:20:32 +01:00
zhsj
eebecad9f8
goprocess: replace go-ps with gopsutil (#187)
The keybase's fork of go-ps seems abandoned, and gopsutil is already
introduced with same functionalities.
2022-11-25 14:16:13 +01:00
Tobias Klauser
4e8ba583e7
Remove vendored modules (#188) 2022-11-22 07:49:29 -08:00
dependabot[bot]
ed01246b0a build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.9 to 3.22.10
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.9 to 3.22.10.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.9...v3.22.10)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 04:10:37 +01:00
dependabot[bot]
f8e83ad200 build(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-07 08:38:41 +01:00
dependabot[bot]
31f906129d build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.8 to 3.22.9
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.8 to 3.22.9.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.8...v3.22.9)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 23:31:51 +02:00
Tobias Klauser
cf6a02a850 Update CI to Go 1.19 2022-09-01 22:51:33 +02:00
dependabot[bot]
6a7f594c94 build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.7 to 3.22.8
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.7 to 3.22.8.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.7...v3.22.8)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-01 22:48:53 +02:00
dependabot[bot]
1b6dca4616 build(deps): bump github.com/shirou/gopsutil/v3 from 3.22.4 to 3.22.7
Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.22.4 to 3.22.7.
- [Release notes](https://github.com/shirou/gopsutil/releases)
- [Commits](https://github.com/shirou/gopsutil/compare/v3.22.4...v3.22.7)

---
updated-dependencies:
- dependency-name: github.com/shirou/gopsutil/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-01 06:36:37 +02:00
dependabot[bot]
ab74a57fd9 build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-31 06:13:22 +02:00
dependabot[bot]
b328946709 build(deps): bump actions/setup-go from 2 to 3
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-31 06:05:39 +02:00
dependabot[bot]
62a38d18c9 build(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-31 05:38:47 +02:00
Tobias Klauser
12769e9c68
ci: add dependabot config (#176) 2022-08-31 02:21:56 +03:00
Glib Smaga
9069aa4d19 Migrate gops to use spf13/cobra for command execution
Manual command setup was starting to show some strain in
terms of documentation and also adding new features
(regardless of what the protocol supports currently).

This new setup aims to make it easier to add new
documentation and functionality.

In comparison to the previous version, this increased the
binary size by 2.4M.
```
6.4M gops
4.0M gops_master
```
2022-08-30 14:31:29 +02:00
Glib Smaga
3655f623db vendor: include cobra 2022-08-30 14:31:29 +02:00
Glib Smaga
024cce5849 internal/cmd: Move code here from the main package 2022-08-30 14:31:29 +02:00
Tobias Klauser
9f8280461a Only report CPU percentage per period if period is > 0
The change in #154 lead to the CPU usage being reported for a 0s
duration:

cpu usage (0s):	NaN%

Fix this by only reporting CPU usage per period if the user specified a
positive duration.
2022-07-08 10:33:55 +02:00
Tobias Klauser
c14dce915a ci: run tests with -race 2022-07-07 18:07:51 +02:00
Tobias Klauser
5ddd2779fb agent: fix data race in Listen
Fix the following data race in agent.Listen:

==================
WARNING: DATA RACE
Write at 0x0000007620a0 by goroutine 9:
  github.com/google/gops/agent.Listen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent.go:112 +0x207
  github.com/google/gops/agent.TestAgentClose()
      /home/tklauser/go/src/github.com/google/gops/agent/agent_test.go:21 +0x6e
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47

Previous read at 0x0000007620a0 by goroutine 8:
  github.com/google/gops/agent.listen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent.go:130 +0x5a

Goroutine 9 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1719 +0xa71
  main.main()
      _testmain.go:57 +0x2e4

Goroutine 8 (finished) created at:
  github.com/google/gops/agent.Listen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent.go:123 +0x43b
  github.com/google/gops/agent.TestListen()
      /home/tklauser/go/src/github.com/google/gops/agent/agent_test.go:13 +0x57
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1486 +0x47
==================
--- FAIL: TestAgentClose (0.00s)
    testing.go:1312: race detected during execution of test
FAIL
FAIL	github.com/google/gops/agent	0.026s
2022-07-07 18:07:51 +02:00
Tobias Klauser
8442404056 internal: inline getOSUserConfigDir 2022-06-27 09:52:46 +02:00
Tobias Klauser
bf851ab3df Sort tree output by PPID
Otherwise the processes might appear in arbitrary order and
disassociated from their parent process. Also avoid printing a stray
newline after the tree.

Before:

```
...
├── 2493
│   └── 4952 (gops) {go1.18.1}
├── 1
│   └── 117 (com.docker.vmnetd) {go1.17.5}
├── 4405
│   └── 4416 (gopls) {go1.18.2}
└── 4404

```

After:

```
...
├── 1
│   └── 117 (com.docker.vmnetd) {go1.17.5}
├── 2493
│   └── 4945 (gops) {go1.18.3}
└── 4404
    └── 4405 (gopls) {go1.18.2}
        └── 4416 (gopls) {go1.18.2}
```
2022-06-24 22:54:34 +02:00
Tobias Klauser
14e2449428
internal: remove getOSUserConfigDir fallback for Go ≤ 1.13 (#170) 2022-06-24 05:13:01 -07:00
Tobias Klauser
35533050c7 go.mod, vendor: update dependencies
Update direct dependencies to the following versions:

- github.com/shirou/gopsutil/v3 v3.22.4
- golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
2022-05-30 14:10:58 +02:00
Tobias Klauser
72a03a3c85
Bump minimum Go version to 1.13 (#169) 2022-05-30 03:03:16 -07:00
Tobias Klauser
33938f8089 Remove CircleCI
CircleCI tests currently seem fail consistently. GitHub actions
introduced in #136 are providing the same coverage (and more), have been
running stable for over a year and are easier to maintain. Thus, remove
Circle CI integration.

Ref. https://github.com/google/gops/pull/136#issuecomment-786529797
2022-05-04 23:47:46 +02:00
Tobias Klauser
53ee352cc8 goprocess: use debug/buildinfo on Go 1.18 and newer
Use package debug/buildinfo [1] introduced in Go 1.18 [2] when possible.
This should avoid previous issues with rsc.io/goversion where Go
processes were no longer listed.

[1] https://pkg.go.dev/debug/buildinfo
[2] https://go.dev/doc/go1.18#debug/buildinfo

For #102
For #159
For #160
2022-05-04 22:48:20 +02:00
Tobias Klauser
3d102a4755 Update CI to Go 1.18
Also only test on the minimum supported version (currently Go 1.12) and
the latest two versions supported by the Go project.
2022-05-04 22:48:20 +02:00
DuckSoft
4e16ac7815
Fix minor white space issue in README.md (#162) 2022-03-16 13:42:24 +01:00
Eli Bendersky
3e83813cbc
Fix minor typo in README.md (#161) 2022-02-10 08:13:40 +00:00
Elton SV
e6cb0303ad
Error out when the given duration is negative (#155)
Validate processInfo period & log a fatal error in the case of negative duration.
2021-11-10 14:15:35 +01:00
Tobias Klauser
db6b6e9ba0 agent: rename setsockoptReuseAddrAndPort to setReuseAddrAndPortSockopts 2021-10-11 18:06:37 +02:00
Tobias Klauser
f38bd6a1ee agent: fix solaris build
Solaris doesn't provide the SO_REUSEPORT socket option.
2021-10-11 18:06:37 +02:00
Tobias Klauser
f57f013e90 go.mod, vendor: update gopsutil and go-ole to fix windows/arm64 build
Update github.com/shirou/gopsutil/v3 to v3.21.9 and
github.com/go-ole/go-ole to latest master to fix the build on
windows/arm64.
2021-10-08 18:51:17 +02:00
Tobias Klauser
e9831286ac go.mod, vendor: update dependencies
Update direct dependencies to the following versions:

  github.com/shirou/gopsutil/v3 v3.21.8
  golang.org/x/sys v0.0.0-20210902050250-f475640dd07b
2021-09-03 09:57:33 +02:00
Tobias Klauser
c5ab645ce5 Use Go 1.17 in CI
Also drop tests for 1.13 and 1.14, these are no longer supported
upstream. Keep 1.12 though as this is the mimimum supported version for
gops.
2021-09-03 09:57:33 +02:00
Tobias Klauser
a22894be16 Add //go:build tags for Go 1.17
Run Go 1.17 gofmt to add //go:build tags.
2021-09-03 09:57:33 +02:00