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: include a warning about generated files when generating files 💪 #33

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ How to release a new version:
### Added
Fazt01 marked this conversation as resolved.
Show resolved Hide resolved
- Use `debug.ReadBuildInfo` to get correct version.
- Print to stderr on error.
- `gen_id` now includes a comment at the top of the generated file to warn developers that the file is, in fact, generated.

### Removed
- `openapi compose`, `repo init`, `repo template` commands.
Expand Down
5 changes: 5 additions & 0 deletions cmd/tea/gen_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
)

var (
outputPreamble = "// Code generated by tea. DO NOT EDIT.\n\n"
// genIDCmd represents the id command
genIDCmd = &cobra.Command{
Use: "id",
Expand Down Expand Up @@ -134,6 +135,10 @@ func (i IDs) generate() ([]byte, error) {
var genData []byte
var err error

if _, err = output.WriteString(outputPreamble); err != nil {
return nil, fmt.Errorf("writing output preamble: %w", err)
}

for typ := range i {
//nolint:gocritic,exhaustive
switch typ {
Expand Down
Loading