microcks / microcks/microcks-cli

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

Offen
#355 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Go
Sterne
52
Forks
68
Ø Merge
6 Std. 54 Min.
Gemergte PRs (30 T.)
10

Beschreibung

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 ./...

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit .github/workflows/build-verify.yml und dem vorhandenen Build Go packages-Schritt, untersuche anschließend Makefile und führe die vorgeschlagenen Go-Prüfungen lokal aus. Als erledigt gilt die Aufgabe, wenn der Workflow bei Pushes und Pull Requests go test ./..., go vet ./... und staticcheck ausführt, passende make test- und make vet-Targets vorhanden sind und alle bestehenden Tests erfolgreich bestehen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
github-actions, go
Bereich
build-system, ci-cd, testing
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
74/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.