Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.0.0 #41

Merged
merged 13 commits into from
Mar 23, 2023
Merged

v3.0.0 #41

merged 13 commits into from
Mar 23, 2023

Conversation

xobotyi
Copy link
Collaborator

@xobotyi xobotyi commented Mar 6, 2023

As of issues with generics and unnamed initializations linter have been completely refactored - it is easier to treat it a ground-up new linter:

  • Linter now uses WithStack traversal - it is simplified and improved detection of structure being initialized within return statement.
  • Generics support
    fix: Generic struct is ignored #39
    close: fix: validate generics #40
  • Slice and map expressions support
    fix: exhaustruct doesn't detect properties not defined in slice expressions #32
  • Due to overall algorithm simplification and optimisations - raw analysis time sligntly decresed for large codebases.
  • Testing improvements
  • (BREAKING CHANGE!) Regular Expressions matching reworked
    Previously: type is matched even if match is partial.
    Now: type is matched only if it is a full match of full type name (including the package name).
  • (BREAKING CHANGE!) Repository structure changed
    Previously: analyzer constructor exposed on /pkg/analyzer subpath.
    Now: analyzer constructor exposed on /analyzer subpath.
  • (BREAKING CHANGE!) Only top level structures allowed to be unintialized during error return.
    Previously: nested structures initialization within error-containing return have been allowed to stay unintialized.
    return typ1{nested: typ2{}}, errors.New("some err")
    Now: above code will yield linting error alike pkgName.typ2 is missing field A
  • (BREAKING CHANGE!) Error message has changed.
    Previously: A, B, C, D ..., Z are missing in TestType
    Now: pkgName.TestType is missing fields A, B, C, D ..., Z

@xobotyi xobotyi self-assigned this Mar 6, 2023
@xobotyi xobotyi added enhancement New feature or request go Pull requests that update Go code labels Mar 6, 2023
@xobotyi xobotyi force-pushed the v3-dev branch 3 times, most recently from 95faf2b to 1a03bf9 Compare March 6, 2023 19:31
@Hades32
Copy link

Hades32 commented Mar 21, 2023

Now: TestType is missing fields A, B, C, D ..., Z

Could this be packagename.TestType? Would make it consistent with the new matching rules (which I'm looking forward to!)

@xobotyi
Copy link
Collaborator Author

xobotyi commented Mar 23, 2023

in case you proposing that github.com/GaijinEntertainment/go-exhaustruct/v3/analyzer.analyzer becomes analyzer.analyzer - agree
otherwise, in case you proposing to output full name - it will be very hard to read the output of linter

@Hades32
Copy link

Hades32 commented Mar 23, 2023

Definitely the former :)

@xobotyi xobotyi merged commit 113a15f into master Mar 23, 2023
@xobotyi xobotyi deleted the v3-dev branch March 23, 2023 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic struct is ignored exhaustruct doesn't detect properties not defined in slice expressions
2 participants