#generate + check

1 messages ยท Page 1 of 1 (latest)

ocean goblet
#

maybe related: I have added a // +check function for each of my functions that would be a // +generate function (assuming i've guessed the use of dagger generate correctly) that ensures that its Changeset is empty.

not sure how you'd do it with a good UX, but it'd be nice if I didn't need to create a "stub" check function for each generate function

#

maybe if the function returns a Changeset, is a check function, and is a generate function, then dagger automatically ensures that the Changeset is empty?

#

here's an example "stub" function that I'm referring to:


// +check
func (m *Example) IsGenerated(ctx context.Context) error {
    if empty, err := m.Generate(ctx).IsEmpty(ctx); err != nil {
        return err
    } else if !empty {
        return fmt.Errorf("source is not generated (run `dagger call generate`)")
    }

    return nil
}
final yoke
ocean goblet
#

sgtm

final yoke