Get support for sagikazarmark/mga
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
sagikazarmark/mga
MGA: Modern Go Application tool
Go application development tool applying modern practices.
The mga
tool is an experimental collection of tools and practices related to developing Go applications.
Its goal is to make the maintenance of applications, thus the life of developers easier.
⚠️ This tool is still under heavy development! Things may change. ⚠️
Currently it includes code generators and scaffolding tools:
- Go kit endpoint generator (based on a service interface)
- Testify mock generator (similar to mockery)
- Event dispatcher generator (based on event interface) (compatible with Watermill)
- Event handler generator (based on event structs) (compatible with Watermill)
Roadmap:
- Application scaffolding (based on Modern Go Application)
- Go kit service scaffolding
- Go kit transport scaffolding/code generator
- and more
See the Modern Go Application for a detailed usage example.
Installation
Download a prebuilt binary from the Releases page, or install the tool from source:
go get sagikazarmark.dev/mga
Usage
Endpoint generator
An endpoint can be generated based on a service interface:
package my
import (
"context"
)
// +kit:endpoint
// Service is a business service.
type Service interface{
// DoSomething is a service call.
//
// Named parameters and results are optional, but they make the generated code nicer.
DoSomething(ctx context.Context, myparam string) (id string, err error)
}
Then run the generator:
mga generate kit endpoint ./...
See Modern Go Application for an example.
Testify mock generator
package my
// +testify:mock
// Service is a business service.
type Service interface{}
// +testify:mock:testOnly=true
// Service2 is a business service.
type Service2 interface{}
mga generate testify mock ./...
Event dispatcher generator
package my
import (
"context"
)
// +mga:event:dispatcher
type Events interface{
MyEvent(ctx context.Context, ev MyEvent) error
}
type MyEvent struct{}
mga generate event dispatcher ./...
See Modern Go Application for an example.
Event handler generator
package my
// +mga:event:handler
type Event struct{
ID string
MyParam string
}
mga generate event handler ./...
See Modern Go Application for an example.
Development
Contributions are welcome! :)
When all coding and testing is done, please run the test suite:
task check
For the best developer experience, install Nix and direnv.
Alternatively, install Go and Task manually or using a package manager.
License
The project is licensed under the MIT License.
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2