Skip to content

Add generate diff check to make sure generated.go not changed #525

Closed
@Xuanwo

Description

@Xuanwo

Background

go-storage has build a codegen definitions (cmd/definitions) to help generated code for our services. And services will call the codegen in doc.go like:

https://github.com/beyondstorage/go-service-s3/blob/4217898092e96b6c2163f4281133eebd8856d90b/doc.go#L4-L6

package s3

//go:generate go run -tags tools github.com/beyondstorage/go-storage/v4/cmd/definitions service.toml

But new contributors could miss the code generate and send PRs with not generated code. So It's better to add a check to make sure our generated.go generated correctly.

Moreover, this workflow checks not only geneated.go but also go.mod / go.sum and so on.

Action

We can add a new workflow called diff_check.yml in which we:

  • setup-go
  • checkout services
  • run make build
  • run git diff and make sure the output is empty (just we did for gofmt)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions