Skip to content

ci: add golangci-lint tooling - #1359

Merged
shizhMSFT merged 6 commits into
notaryproject:mainfrom
Tatsinnit:docs/architecture-and-lint-tooling
Aug 3, 2026
Merged

ci: add golangci-lint tooling#1359
shizhMSFT merged 6 commits into
notaryproject:mainfrom
Tatsinnit:docs/architecture-and-lint-tooling

Conversation

@Tatsinnit

@Tatsinnit Tatsinnit commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR is scoped to golangci-lint developer/CI tooling only — additive, non-breaking, no source, CLI, or dependency changes.

(Note: this PR originally also included an ARCHITECTURE.md doc; per review discussion, that was split out into its own follow-up PR so this one stays focused and easy to review.)

Developer / CI tooling (additive, non-breaking)

  • Add .golangci.yml (golangci-lint v2) with a conservative linter set (bodyclose, misspell, revive, unconvert, whitespace + gofmt/goimports formatters).
  • Adopted incrementally via issues.new-from-merge-base: origin/main, so only issues introduced by a PR (relative to its merge base with main) fail CI — the existing lint backlog is not enforced.
  • Add a make lint target.
  • Add a Lint step to build.yml (golangci-lint-action v8, golangci-lint v2.5.0), and set fetch-depth: 0 on checkout so merge-base gating has the git history it needs to diff against.

Compatibility

  • golangci-lint v2.5.0 is itself built with go 1.24.0 and fully supports this module's declared go 1.24.0 toolchain — no version mismatch.
  • CI already sets up Go 1.24 via actions/setup-go before the lint step runs, so golangci-lint type-checks against that same toolchain.

Why it is safe

  • No changes under cmd/ or internal/ — no behavior, API, or CLI-flag changes.
  • No go.mod/dependency or Go toolchain changes.
  • Lint gate is non-breaking by design (new-from-merge-base), so it cannot fail on the pre-existing backlog (~76 pre-existing findings remain and are unaffected).

Signed commits ✅

Add ARCHITECTURE.md documenting the codebase map, package layout, core
sign/verify workflows, trust model, and developer workflow, linked from
README.md and building.md.

Add golangci-lint tooling: a conservative .golangci.yml adopted
incrementally via new-from-rev, a 'lint' Makefile target, and a CI lint
step (with fetch-depth: 0 so new-from-rev gating has git history).

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.09%. Comparing base (51ff5ec) to head (12b382b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1359   +/-   ##
=======================================
  Coverage   79.09%   79.09%           
=======================================
  Files          68       68           
  Lines        3076     3076           
=======================================
  Hits         2433     2433           
  Misses        436      436           
  Partials      207      207           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an architecture overview document and introduces additive Go lint tooling/CI wiring to improve contributor onboarding and maintain code quality without enforcing the existing lint backlog.

Changes:

  • Add ARCHITECTURE.md and link it from README.md and building.md.
  • Add a make lint target and a golangci-lint v2 configuration.
  • Add a golangci-lint GitHub Actions step and adjust checkout depth for new-issues gating.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Adds a top-level link to the new architecture overview document.
Makefile Introduces a lint target for running golangci-lint locally.
building.md Links to ARCHITECTURE.md for codebase structure context.
ARCHITECTURE.md New architecture and workflow documentation for the codebase.
.golangci.yml Adds golangci-lint v2 configuration intended for incremental adoption.
.github/workflows/build.yml Adds CI lint step and ensures git history is available for new-issues gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .golangci.yml Outdated
Comment thread .github/workflows/build.yml
Comment thread ARCHITECTURE.md Outdated
new-from-rev: HEAD compares the tree against itself, producing an empty
diff so no PR-introduced issues are ever reported. Switch to
new-from-merge-base: origin/main so lint issues introduced by a PR are
caught while the pre-existing backlog stays unenforced. Update the
build.yml checkout comment and ARCHITECTURE.md to match.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
Comment thread ARCHITECTURE.md Outdated
Comment thread ARCHITECTURE.md Outdated
Comment thread ARCHITECTURE.md Outdated
Comment thread ARCHITECTURE.md Outdated
- Remove package-layout tables; defer symbol-level detail to godoc.
- Convert ASCII diagrams to mermaid (high-level, sign/verify, CI/CD).
- Remove hard line-wrapping in prose per markdown preference.
- Remove the Improvement Opportunities section; such items belong in
  roadmaps/issues rather than architecture docs.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
@Tatsinnit
Tatsinnit requested a review from shizhMSFT August 3, 2026 02:41
Comment thread ARCHITECTURE.md Outdated
Comment thread ARCHITECTURE.md Outdated
- Redesign all mermaid diagrams for readability: flat top-down layered
  tree for the high-level architecture (no cramped nested subgraphs),
  simple left-to-right pipelines for sign/verify workflows, and a
  two-lane CI/CD diagram. Verified rendering via mermaid-cli.
- Add a callout to the Trust Model section pointing to
  notaryproject/specifications as the source of truth; this doc is a
  practical implementation summary, not a restatement of the spec.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
Color-code each layer (CLI, CLI-internal, shared utils, external libs),
bold the package paths, and label edges (delegates to / built on /
calls) so relationships are explicit rather than implied by bare
arrows. Verified rendering locally with mermaid-cli before pushing.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
@Tatsinnit
Tatsinnit requested a review from shizhMSFT August 3, 2026 05:49
@Tatsinnit

Tatsinnit commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Hiya team, thank you so much for all the thoughtful review so far, it's genuinely helped tighten this up! Given there is no release happened for this repo for a while. ❤️

One thought on scope: if it makes reviewing easier, I'm happy to split this PR so the golangci-lint tooling (.golangci.yml, make lint, CI wiring) lands on its own, and pull ARCHITECTURE.md out into a separate follow-up PR. That would let the lint changes merge cleanly without being tied to further doc iteration, and give the architecture doc its own focused review cycle.

Totally happy to go either way, just let me know what you'd prefer and I'll action it right away. Thanks again for your guidance here!

Per review discussion, split scope: keep this PR limited to the
golangci-lint tooling (.golangci.yml, make lint, CI wiring) and move
the architecture overview to a separate follow-up PR for its own
focused review.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
@Tatsinnit

Copy link
Copy Markdown
Contributor Author

Update: went ahead and split this out — removed ARCHITECTURE.md (and its links from README.md/building.md) from this PR in 12b382b. This PR is now scoped to just the golangci-lint tooling (.golangci.yml, make lint, CI wiring), which should make it a smaller, easier review. I'll open the architecture doc as its own follow-up PR separately. Thanks again!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

.golangci.yml:53

  • go.mod declares the module path as github.com/notaryproject/notation/v2, but goimports local-prefixes is set to github.com/notaryproject/notation. This can cause goimports to treat this module's own imports as third-party and reorder them unexpectedly.
        - github.com/notaryproject/notation

@Tatsinnit Tatsinnit changed the title docs: add architecture overview and golangci-lint tooling docs: add golangci-lint tooling Aug 3, 2026
@shizhMSFT shizhMSFT changed the title docs: add golangci-lint tooling ci: add golangci-lint tooling Aug 3, 2026

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT
shizhMSFT merged commit 2c82269 into notaryproject:main Aug 3, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

3 participants