golang 单元测试以及单元测试报告

单元测试范例

单元测试结果输出

go test -cover -coverprofile=c.out ./

单元测试html 输出

go tool cover -html=c.out -o coverage.html

gitlab 将报告生成为pages

build:
  script:
  - mkdir public
  - go test -cover -coverprofile=c.out ./
  - go tool cover -html=c.out -o public/coverage.html
  artifacts:
    paths:
      - public/
pages:
  stage: deploy
  dependencies:
    - build
  script:
    - ls public/
  artifacts:
    paths:
      - public
    expire_in: 30 days
  only:
    - master
humboldt Written by:

humboldt 的趣味程序园