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

Allow //exhaustive:ignore on potential enums #78

Merged

Conversation

iwahbe
Copy link
Contributor

@iwahbe iwahbe commented Apr 9, 2024

Fixes #76

This PR enables these examples:

Ignoring declared constants (d9dc665):

type DeclIgnoredEnum int // want no enum detected

//exhaustive:ignore
const (
	DeclIgnoredMamberA DeclIgnoredEnum = 1
	DeclIgnoredMamberB DeclIgnoredEnum = 2
)

//exhaustive:ignore
const DeclIgnoredMamberC DeclIgnoredEnum = 3

Ignoring declared types (272c2ab):

//exhaustive:ignore
type DeclTypeIgnoredEnum int

const (
	DeclTypeIgnoredMamberA DeclTypeIgnoredEnum = 1
	DeclTypeIgnoredMamberB DeclTypeIgnoredEnum = 2
)

Both commits are under test.

Fixes nishanths#76

This PR enables the syntax:

```go
type DeclIgnoredEnum int // want no enum detected

//exhaustive:ignore
const (
	DeclIgnoredMamberA DeclIgnoredEnum = 1
	DeclIgnoredMamberB DeclIgnoredEnum = 2
)

//exhaustive:ignore
const DeclIgnoredMamberC DeclIgnoredEnum = 3
```
testdata/src/enum/enum.go Outdated Show resolved Hide resolved
enum.go Outdated Show resolved Hide resolved
enum.go Show resolved Hide resolved
@nishanths
Copy link
Owner

Thanks for the pull request. I added some comments.

@iwahbe iwahbe force-pushed the iwahbe/76/allow-ignore-on-potential-enums branch 2 times, most recently from 879bd2c to fc6d38d Compare April 19, 2024 23:36
Adds support for the syntax:

```go
//exhaustive:ignore
type DeclTypeIgnoredEnum int

const (
	DeclTypeIgnoredMamberA DeclTypeIgnoredEnum = 1
	DeclTypeIgnoredMamberB DeclTypeIgnoredEnum = 2
)
```
@iwahbe iwahbe force-pushed the iwahbe/76/allow-ignore-on-potential-enums branch from fc6d38d to ce37a1d Compare April 19, 2024 23:41
@iwahbe iwahbe requested a review from nishanths April 19, 2024 23:41
@iwahbe
Copy link
Contributor Author

iwahbe commented Apr 19, 2024

Hey @nishanths. Thanks for the excellent feedback. I have addressed your comments.

enum.go Outdated Show resolved Hide resolved
enum.go Outdated Show resolved Hide resolved
enum.go Outdated Show resolved Hide resolved
@nishanths
Copy link
Owner

Added a few more comments (one blocking). Looks good to me after that.

@iwahbe iwahbe requested a review from nishanths May 3, 2024 22:03
@iwahbe
Copy link
Contributor Author

iwahbe commented May 3, 2024

Thanks for the feedback. I addressed it and am ready for another round of review. I really appreciate your patience here.

@nishanths
Copy link
Owner

Thanks for the feedback. I addressed it and am ready for another round of review. I really appreciate your patience here.

You're welcome, and it's no problem at all. Thank you for updating!

@nishanths nishanths merged commit 80ad0aa into nishanths:master May 4, 2024
9 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.

Feature Request: Allow specifying that a type isn't an enum
2 participants