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

added GoInitialismsConfig which overrides the initialisms to be regarded #2683

Merged
merged 5 commits into from
Jun 21, 2023
Merged

Conversation

JonasDoe
Copy link
Contributor

@JonasDoe JonasDoe commented Jun 20, 2023

Fixes #1383 by adding another config option which allows to override the initialsms. Based on this discussion.
In general, the solution feels bit wonky, but I can't come up with something better. Ideally, methods like ToGo and ToGoPrivate would be bound to a method receiver which could - amongst other in the future - settings regarding the initialisms. This would break with plugins, though.

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

@JonasDoe
Copy link
Contributor Author

JonasDoe commented Jun 20, 2023

Not sure yet how to test the whole Config's effect in the template package without exporting more methods than necessary.
I tested it with the todo example and it seems to work fine, though.

@JonasDoe JonasDoe marked this pull request as ready for review June 20, 2023 18:09
@coveralls
Copy link

coveralls commented Jun 20, 2023

Coverage Status

coverage: 79.224% (+0.06%) from 79.16% when pulling 9ba27af on JonasDoe:master into ee6add4 on 99designs:master.

docs/config.yml Outdated Show resolved Hide resolved
docs/config.yml Outdated Show resolved Hide resolved
@JonasDoe
Copy link
Contributor Author

JonasDoe commented Jun 21, 2023

Just took a short dive into go linting - didn't even expect such a thing to exist in Go due to its own strict styling specs. Anyway, fixed the faulty import.

@StevenACoffman
Copy link
Collaborator

Sorry about that. You would be surprised at how pedantic some people can be about trivial stylistic formatting. Probably a habit picked up from Python. :)

I don't really care about it much, as long as I can have a magic command to run that makes the code so everyone can focus on more important things.

gofumpt and golines are quite reliable and can be used together:

golines -m 100 --base-formatter=gofumpt -w ./...

For imports, goimports and gci work okay-ish:

goimports -l -w -local github.com/99designs/gqlgen .
gci write -s standard -s default -s "prefix(github.com/99designs/gqlgen)" --skip-generated .

With those last two, sometimes the comments get wonky, but either works most of the time.

@StevenACoffman StevenACoffman merged commit 3b295bb into 99designs:master Jun 21, 2023
@StevenACoffman
Copy link
Collaborator

Thanks for your contribution!

@JonasDoe
Copy link
Contributor Author

Sorry about that. You would be surprised at how pedantic some people can be about trivial stylistic formatting. Probably a habit picked up from Python. :)

I don't really care about it much, as long as I can have a magic command to run that makes the code so everyone can focus on more important things.

gofumpt and golines are quite reliable and can be used together:

golines -m 100 --base-formatter=gofumpt -w ./...

For imports, goimports and gci work okay-ish:

goimports -l -w -local github.com/99designs/gqlgen .
gci write -s standard -s default -s "prefix(github.com/99designs/gqlgen)" --skip-generated .

With those last two, sometimes the comments get wonky, but either works most of the time.

I see - thanks for these instructions! :)

@StevenACoffman
Copy link
Collaborator

Thanks for your patience and contribution! I'm looking forward to your next PR!

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.

Unpredictable and contradictory naming behavior
3 participants