You can generate Go code for Event Sourcing using a simple DSL or code templates. One easy way is to create a config file (JSON, YAML) that defines your entities and events, then use Go's text/template package to generate the ApplyEvent methods automatically. You can run this with go generate during the build process. If you want more control, try to create a custom parser using tools like ANTLR or Pigeon, this will reduce code duplication and will keep services clean and maintainable.