Fix long lines in bson/decoder_example_test.go and expand check-fmt to cover both *_example_test.go and *_examples_test.go files

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • 2.7.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      The check-fmt tool checks that example test files have lines wrapped at 80 characters to keep them readable when rendered on pkg.go.dev. Currently, as part of the migration of check_fmt.sh to a Go program (GODRIVER-3936), the check only covers files matching the plural form *_examples_test.go. It should also cover the singular form *_example_test.go, as both are used in the repo for example tests.

      Expanding the check to cover *_example_test.go exposes existing line length violations in bson/decoder_example_test.go:

      • Line 68: 99 characters
      • Line 113: 99 characters
      • Line 123: 81 characters
      • Line 182: 98 characters

      Definition of done

      • The check-fmt tool is updated to check both *_examples_test.go and *_example_test.go files.
      • All lines in bson/decoder_example_test.go are wrapped at 80 characters or fewer, excluding lines containing URI-like strings in comments (e.g. // https://...) or testable example output markers (e.g. // Output: ...), which are intentionally exempt from the line length limit.
      • The task check-fmt command passes locally with no violations.

            Assignee:
            Lin Borland
            Reporter:
            Lin Borland
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: