microcks / microcks/microcks-cli

ci: add go test, go vet, and staticcheck gates to the build-verify workflow

オープン
#355 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Go
スター
52
フォーク
68
平均マージ
6時間 54分
マージ済み PR(30日)
10

説明

Reason/Context

The current build-verify.yml CI workflow only compiles binaries — it never runs tests, go vet, or any static analysis. This means bugs ship silently and contributors get no automated feedback on correctness.

Proof from the current open PR queue — every one of these bugs existed in master and CI never caught them:

  1. req.Body read instead of resp.Body in DownloadArtifact → PR #338 (go vet catches this)
  2. panic(err.Error()) in connector code → PR #341, #319 (staticcheck catches this)
  3. TestDeleteContext fails on every clean checkout → PR #334 (go test ./... catches this)
  4. OAuth2 tokens printed unconditionally to stderr → PR #345 (caught by tests with log capture)
  5. String-concatenation JSON injection risk → PR #341 (staticcheck catches this)

The motivation: CI should be the first line of defence. Right now it is not.

Description

Add three mandatory quality gates to build-verify.yml that run on every PR and push:

  1. go test ./... — runs the existing unit test suite (currently never executed in CI)
  2. go vet ./... — Go's built-in analyser, catches real bugs like wrong body reads, bad panic arguments, printf mismatches
  3. staticcheck — industry-standard linter, zero config, no false positives

Also add make test and make vet targets to Makefile so contributors can run the same checks locally before pushing.

This is not a breaking change — it only adds new CI steps. If existing tests are currently failing on master,
those failures will need to be fixed as part of this PR.

Implementation ideas

Add before the existing Build Go packages step in .github/workflows/build-verify.yml:

- name: Run unit tests
  run: go test ./...

- name: Run go vet
  run: go vet ./...

- name: Run staticcheck
  uses: dominikh/staticcheck-action@v1
  with:
    version: latest
    install-go: false


`staticcheck` is preferred over `golangci-lint` — zero config, no false positives, directly catches the bug classes above.

Add to `Makefile`:

```makefile
.PHONY: test
test:
	go test ./...

.PHONY: vet
vet:
	go vet ./...

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Start with .github/workflows/build-verify.yml and the existing Build Go packages step, then inspect Makefile and run the proposed Go checks locally. Done means the workflow runs go test ./..., go vet ./..., and staticcheck on pushes and pull requests, with matching make test and make vet targets and all existing tests passing.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github-actions, go
領域
build-system, ci-cd, testing
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
74/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。