the best advice I ever received, nearly ten years ago now, from by far the best programmer I've ever met was "be your own linter", an ethos that persists in my approach to writing every single day.
I shipped a transaction bug, so I built a linter
11–14 of 14 posts
Re: I shipped a transaction bug, so I built a linter
#12I would question the framework design: the method is called "UpdateUser", so it should be executed in a transaction, so it should be a parameter of the service, and the transaction logic handled by the framework. func (s \*Service) UpdateUser(ctx context.Context, tx models.Repo, userID string) error { user, err := tx.GetUser(ctx, userID) if err != nil { return err } user.Name = "Updated" return tx.SaveUser(ctx, user)…
[deleted]
Re: I shipped a transaction bug, so I built a linter
#13Hey this is exactly the pattern we have and the bugs we need to catch… yoink?
Re: I shipped a transaction bug, so I built a linter
#14This is the way, stop relying on somebody else to stop doing dumb things and write your linter today.