Skip to content

Doc: run linter on markdown code blocks #702

Open

Description

@samber

@ccoVeille suggested https://github.com/hougesen/mdsf, which seems a good project wrapping golangci-lint.

Currently, the project is missing some features: hougesen/mdsf#1333 + hougesen/mdsf#448 + hougesen/mdsf#386

Tasks:

  • add config file at the repository root
  • add github action
  • add to makefile

Activity

  1. intojhanurag commented on Oct 5, 2025

    @intojhanurag
    Contributor

    Hey @samber
    Can I work on one of the tasks mentioned above (like adding the GitHub Action or config file)?
    Just wanted to confirm if this issue is open for normal contributors or if it’s planned to be handled internally.

  2. samber commented on Oct 5, 2025

    @samber
    OwnerAuthor

    This is open to contributors, but some improvements have to be made to mdsf before doing my checklist.

    💯💯💯

  3. intojhanurag commented on Oct 5, 2025

    @intojhanurag
    Contributor

    Got it, thanks for clarifying! I’ll keep an eye on the mdsf updates and jump in once those improvements are ready.

  4. ccoVeille commented on Nov 12, 2025

    @ccoVeille
    Contributor

    The following PR brought most of what wascreporree as missing in this issue

  5. samber commented on Nov 12, 2025

    @samber
    OwnerAuthor

    Wonderful ✌️

    @hougesen suggested the following config

    {
      "languages": {
        "go": {
          "binary": "/mylinter",
          "arguments": ["run", "--config", ".mylinter.yaml", "$PATH"]
        }
      }
    }
  6. AhmedCharfeddine commented on May 8, 2026

    @AhmedCharfeddine

    Hello, I wanted to work on this issue since it's been sitting for a while. I'm not sure how linting for code blocks should work. The steps I did were:

    1. Add the mdsf config file, as per @samber's comment. Also specified golangci-lint as the binary while referencing its config file in the repo root
    2. Running the commented mdsf command in the makefile: mdsf verify --debug --log-level warn docs/
      This prints out a lot of false positives since the linter requires a full compilable go program, which the markdown snippets aren't. Example:
    ../../.cache/mdsf/mdsfM8uXDtnoR0b0.go:2:1: expected declaration, found count (typecheck)
    count, dur, err := lo.AttemptWhileWithDelay(
    ^
    1 issues:
    * typecheck: 1
    docs/data/core-attemptwhilewithdelay.md:21 to :29 error running golangci-lint
    

    Am I missing something or is linting for snippets unfeasible?

    Side note

    The make tools command installs an old version of golangci-lint (1.xx) despite referencing @ latest. This conflicts with the linter config file in this repo, which requires version 2. I fixed this for me by specifying some 2.x version as per their docs. Should we align the makefile with this small adjustment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions