{"id":13416798,"url":"https://github.com/google/gops","last_synced_at":"2025-09-09T20:48:57.066Z","repository":{"id":39516451,"uuid":"73430589","full_name":"google/gops","owner":"google","description":"A tool to list and diagnose Go processes currently running on your system","archived":false,"fork":false,"pushed_at":"2025-08-12T04:33:04.000Z","size":6795,"stargazers_count":6946,"open_issues_count":31,"forks_count":337,"subscribers_count":103,"default_branch":"master","last_synced_at":"2025-09-03T08:55:25.520Z","etag":null,"topics":["cpu-profile","diagnostics","go","go-tools","golang","heap-profile"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-11-10T23:49:31.000Z","updated_at":"2025-09-02T10:31:34.000Z","dependencies_parsed_at":"2022-07-14T11:30:45.475Z","dependency_job_id":"a98b9450-4061-4e9c-a311-b51d139db485","html_url":"https://github.com/google/gops","commit_stats":{"total_commits":284,"total_committers":45,"mean_commits":6.311111111111111,"dds":0.6232394366197183,"last_synced_commit":"bd3365ed88a029a1ebe1febffb21e725fd188d53"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/google/gops","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fgops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fgops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fgops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fgops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/gops/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fgops/sbom","scorecard":{"id":437123,"data":{"date":"2025-08-11","repo":{"name":"github.com/google/gops","commit":"a2d8f7790eac63a6668583a060cb45903410a91b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/google/gops/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/google/gops/test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/google/.github/SECURITY.md:1","Info: Found linked content: github.com/google/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/google/.github/SECURITY.md:1","Info: Found text in security policy: github.com/google/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":2,"reason":"SAST tool is not run on all commits -- score normalized to 2","details":["Warn: 8 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T04:57:07.510Z","repository_id":39516451,"created_at":"2025-08-19T04:57:07.511Z","updated_at":"2025-08-19T04:57:07.511Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273485420,"owners_count":25114129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu-profile","diagnostics","go","go-tools","golang","heap-profile"],"created_at":"2024-07-30T22:00:22.334Z","updated_at":"2025-09-09T20:48:57.029Z","avatar_url":"https://github.com/google.png","language":"Go","readme":"# gops\n\n[![GitHub Action Status](https://github.com/google/gops/workflows/Tests/badge.svg)](https://github.com/google/gops/actions?query=workflow%3ATests)\n[![GoDoc](https://godoc.org/github.com/google/gops?status.svg)](https://godoc.org/github.com/google/gops)\n\ngops is a command to list and diagnose Go processes currently running on your system.\n\n```sh\n$ gops\n983   980    uplink-soecks  go1.9   /usr/local/bin/uplink-soecks\n52697 52695  gops           go1.10  /Users/jbd/bin/gops\n4132  4130   foops        * go1.9   /Users/jbd/bin/foops\n51130 51128  gocode         go1.9.2 /Users/jbd/bin/gocode\n```\n\n## Installation\n\nTo install the latest version of gops:\n\n```sh\n$ go get github.com/google/gops\n```\n\nor\n\n```sh\n$ go install github.com/google/gops@latest\n```\n\nTo install a specific gops version, for example v0.3.19:\n\n```sh\n$ go install github.com/google/gops@v0.3.19\n```\n\n## Diagnostics\n\nFor processes that start the diagnostics agent, gops can report\nadditional information such as the current stack trace, Go version, memory\nstats, etc.\n\nIn order to start the diagnostics agent, see the [hello example](https://github.com/google/gops/blob/master/examples/hello/main.go).\n\n``` go\npackage main\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/google/gops/agent\"\n)\n\nfunc main() {\n\tif err := agent.Listen(agent.Options{}); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ttime.Sleep(time.Hour)\n}\n```\n\nOtherwise, you could set `GOPS_CONFIG_DIR` environment variables to assign your config dir.\nDefault, gops will use the current user's home directory(AppData on windows).\n\n### Manual\n\nIt is possible to use gops tool both in local and remote mode.\n\nLocal mode requires that you start the target binary as the same user that runs gops binary.\nTo use gops in a remote mode you need to know target's agent address.\n\nIn Local mode use process's PID as a target; in Remote mode target is a `host:port` combination.\n\n#### Listing all processes running locally\n\nTo print all go processes, run `gops` without arguments:\n\n```sh\n$ gops\n983   980    uplink-soecks  go1.9   /usr/local/bin/uplink-soecks\n52697 52695  gops           go1.10  /Users/jbd/bin/gops\n4132  4130   foops        * go1.9   /Users/jbd/bin/foops\n51130 51128  gocode         go1.9.2 /Users/jbd/bin/gocode\n```\n\nThe output displays:\n* PID\n* PPID\n* Name of the program\n* Go version used to build the program\n* Location of the associated program\n\nNote that processes running the agent are marked with `*` next to the PID (e.g. `4132*`).\n\n#### $ gops \\\u003cpid\\\u003e [duration]\n\nTo report more information about a process, run `gops` followed by a PID:\n\n```sh\n$ gops \u003cpid\u003e\nparent PID:\t5985\nthreads:\t27\nmemory usage:\t0.199%\ncpu usage:\t0.139%\nusername:\tjbd\ncmd+args:\t/Applications/Splice.app/Contents/Resources/Splice Helper.app/Contents/MacOS/Splice Helper -pid 5985\nlocal/remote:\t127.0.0.1:56765 \u003c-\u003e :0 (LISTEN)\nlocal/remote:\t127.0.0.1:56765 \u003c-\u003e 127.0.0.1:50955 (ESTABLISHED)\nlocal/remote:\t100.76.175.164:52353 \u003c-\u003e 54.241.191.232:443 (ESTABLISHED)\n```\n\nIf an optional duration is specified in the format as expected by\n[`time.ParseDuration`](https://golang.org/pkg/time/#ParseDuration), the CPU\nusage for the given time period is reported in addition:\n\n```sh\n$ gops \u003cpid\u003e 2s\nparent PID:\t5985\nthreads:\t27\nmemory usage:\t0.199%\ncpu usage:\t0.139%\ncpu usage (2s):\t0.271%\nusername:\tjbd\ncmd+args:\t/Applications/Splice.app/Contents/Resources/Splice Helper.app/Contents/MacOS/Splice Helper -pid 5985\nlocal/remote:\t127.0.0.1:56765 \u003c-\u003e :0 (LISTEN)\nlocal/remote:\t127.0.0.1:56765 \u003c-\u003e 127.0.0.1:50955 (ESTABLISHED)\nlocal/remote:\t100.76.175.164:52353 \u003c-\u003e 54.241.191.232:443 (ESTABLISHED)\n```\n\n#### $ gops tree\n\nTo display a process tree with all the running Go processes, run the following command:\n\n```sh\n$ gops tree\n\n...\n├── 1\n│   └── 13962 [gocode] {go1.9}\n├── 557\n│   └── 635 [com.docker.supervisor] {go1.9.2}\n│       └── 638 [com.docker.driver.amd64-linux] {go1.9.2}\n└── 13744\n    └── 67243 [gops] {go1.10}\n```\n\n#### $ gops stack (\\\u003cpid\\\u003e|\\\u003caddr\\\u003e)\n\nIn order to print the current stack trace from a target program, run the following command:\n\n\n```sh\n$ gops stack (\u003cpid\u003e|\u003caddr\u003e)\ngops stack 85709\ngoroutine 8 [running]:\nruntime/pprof.writeGoroutineStacks(0x13c7bc0, 0xc42000e008, 0xc420ec8520, 0xc420ec8520)\n\t/Users/jbd/go/src/runtime/pprof/pprof.go:603 +0x79\nruntime/pprof.writeGoroutine(0x13c7bc0, 0xc42000e008, 0x2, 0xc428f1c048, 0xc420ec8608)\n\t/Users/jbd/go/src/runtime/pprof/pprof.go:592 +0x44\nruntime/pprof.(*Profile).WriteTo(0x13eeda0, 0x13c7bc0, 0xc42000e008, 0x2, 0xc42000e008, 0x0)\n\t/Users/jbd/go/src/runtime/pprof/pprof.go:302 +0x3b5\ngithub.com/google/gops/agent.handle(0x13cd560, 0xc42000e008, 0xc420186000, 0x1, 0x1, 0x0, 0x0)\n\t/Users/jbd/src/github.com/google/gops/agent/agent.go:150 +0x1b3\ngithub.com/google/gops/agent.listen()\n\t/Users/jbd/src/github.com/google/gops/agent/agent.go:113 +0x2b2\ncreated by github.com/google/gops/agent.Listen\n\t/Users/jbd/src/github.com/google/gops/agent/agent.go:94 +0x480\n# ...\n```\n\n#### $ gops memstats (\\\u003cpid\\\u003e|\\\u003caddr\\\u003e)\n\nTo print the current memory stats, run the following command:\n\n```sh\n$ gops memstats (\u003cpid\u003e|\u003caddr\u003e)\n```\n\n#### $ gops gc (\\\u003cpid\\\u003e|\\\u003caddr\\\u003e)\n\nIf you want to force run garbage collection on the target program, run `gc`.\nIt will block until the GC is completed.\n\n#### $ gops setgc (\\\u003cpid\\\u003e|\\\u003caddr\\\u003e) \u003cperc\u003e\n\nSets the garbage collection target to a certain percentage.\nThe following command sets it to 10%:\n\n``` sh\n$ gops setgc (\u003cpid\u003e|\u003caddr\u003e) 10\n```\nThe following command turns off the garbage collector:\n\n```sh\n$ gops setgc (\u003cpid\u003e|\u003caddr\u003e) off\n```\n\n#### $ gops version (\\\u003cpid\\\u003e|\\\u003caddr\\\u003e)\n\ngops reports the Go version the target program is built with, if you run the following:\n\n```sh\n$ gops version (\u003cpid\u003e|\u003caddr\u003e)\ndevel +6a3c6c0 Sat Jan 14 05:57:07 2017 +0000\n```\n\n#### $ gops stats (\\\u003cpid\\\u003e|\\\u003caddr\\\u003e)\n\nTo print the runtime statistics such as number of goroutines and `GOMAXPROCS`.\n\n#### Profiling\n\n\n##### Pprof\n\ngops supports CPU and heap pprof profiles. After reading either heap or CPU profile,\nit shells out to the `go tool pprof` and let you interactively examine the profiles.\n\nTo enter the CPU profile, run:\n\n```sh\n$ gops pprof-cpu (\u003cpid\u003e|\u003caddr\u003e)\n```\n\nTo enter the heap profile, run:\n\n```sh\n$ gops pprof-heap (\u003cpid\u003e|\u003caddr\u003e)\n```\n\n##### Execution trace\n\ngops allows you to start the runtime tracer for 5 seconds and examine the results.\n\n```sh\n$ gops trace (\u003cpid\u003e|\u003caddr\u003e)\n```\n","funding_links":[],"categories":["Popular","Misc","Go","开源类库","Open source library","Debugging \u0026 Profiling \u0026 Tracing"],"sub_categories":["调试","Debugging","For Go"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fgops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fgops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fgops/lists"}