Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goc build --singleton 时 如何获取coverage file #367

Open
zhangtongrui opened this issue Mar 4, 2024 · 1 comment
Open

goc build --singleton 时 如何获取coverage file #367

zhangtongrui opened this issue Mar 4, 2024 · 1 comment

Comments

@zhangtongrui
Copy link

当 goc build --singleton时, 是不是意味着不需要启动 goc server, 此时怎么获取覆盖率文件?

@qwe854896
Copy link

您好,若使用 singleton 模式時,代表它不會有向 server 註冊自身的動作。

將服務跑起來後,您可以注意到同一資料夾中出現 "${executable_name}_profile_listen_addr",裡面將會有一個 address 的資訊,這個位置提供以下三種 GET API:

  1. /v1/cover/coverage
  2. /v1/cover/profile
  3. /v1/cover/clear

舉例來說,若 goc build . 產出的 binary 為 ./simple-go-server,那麼在它被運行起來時,將會產生一個名為 simple-go-server_profile_listen_addr 的檔案。
假設該檔案的內容為 127.0.0.1:32921,您接著可以使用 curl 127.0.0.1:32921/v1/cover/profile 獲取 profile 資訊。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants