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

feat: gqlgen ver in generated file notice and entire file notice optional #2617

Merged
merged 3 commits into from
Apr 14, 2023

Conversation

hexnaught
Copy link
Contributor

Describe your PR and link to any relevant issues.

The gqlgen version printed in the file notice adds a lot of noise to PRs in all of the services we use gqlgen at my current company when we regenerate files. There is an existing issue for removing the file notice entirely so I have added two new config options to.

  • Omit the gqlgen version but keep the current file notice in tact
  • Omit the file notice in its entirety.

Both are 'omit' options and defaulted to false to continue current behaviour.

# Optional: turn on to not generate any file notice comments in generated files
omit_gqlgen_file_notice: false

# Optional: turn on to exclude the gqlgen version in the generated file notice. No effect if `omit_gqlgen_file_notice` is true.
omit_gqlgen_version_in_file_notice: false

Output

Both omit options false

package graph

// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.29-dev

import (
	"context"

Omit file version true

package graph

// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen

import (
	"context"

Omit file notice true

package graph

import (
	"context"

Both omit options true

package graph

import (
	"context"

I have:

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

Resolves #2413

This commit allows the user of gqlgen to configure whether or not the
version of gqlgen used to generate the files is included in the
filenotice/comment header for generated files.
@coveralls
Copy link

Coverage Status

Coverage: 78.534% (+3.3%) from 75.274% when pulling 730c694 on hexnaught:master into 498ce3f on 99designs:master.

@StevenACoffman StevenACoffman merged commit acd4b07 into 99designs:master Apr 14, 2023
@StevenACoffman
Copy link
Collaborator

Thanks! I appreciate you making this improvement backward compatible.

@hexnaught
Copy link
Contributor Author

hexnaught commented Apr 17, 2023

@StevenACoffman No problem! Always fun helping out/contributing to projects we use! Would you be comfortable doing a release with this feature and a minor version bump, otherwise any idea on timeline/how regular/what criteria is for a releases to happen? I can pin our usage to the commit of main but would rather work off of release versions 🙏

@StevenACoffman
Copy link
Collaborator

StevenACoffman commented Apr 18, 2023

Sure, but I try to aggregate improvements and not release more than once a week, depending on how slammed I am at my day job (often it waits until the weekend), so I'm just waiting another day or so.

@hexnaught
Copy link
Contributor Author

@StevenACoffman All good! Thanks for all your great work on this!

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.

Option to disable comment generation
3 participants