https://github.com/datosh/gau
Go ArchUnit Test Framework
https://github.com/datosh/gau
architecture go golang testing
Last synced: 8 months ago
JSON representation
Go ArchUnit Test Framework
- Host: GitHub
- URL: https://github.com/datosh/gau
- Owner: datosh
- License: mit
- Created: 2022-05-29T14:07:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-07T15:13:25.000Z (over 3 years ago)
- Last Synced: 2024-06-19T20:51:51.645Z (over 1 year ago)
- Topics: architecture, go, golang, testing
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gau
Golang ArchUnit (gau) Test Framework enables you to test your application's
architecture using Go's build-in unit-testing capabilities.
An example rule could look like this:
```go
func TestSimple(t *testing.T) {
Packages(t, "github.com/datosh/gau/tests/...").That().
ResideIn("github.com/datosh/gau/tests/dependona").
Should().DirectlyDependOn("github.com/datosh/gau/tests/a")
}
```
## Credit
* [Java ArchUnit](https://www.archunit.org/)
* [matthewmcnew/archtest](https://github.com/matthewmcnew/archtest)
* not maintained, slow for bigger projects
* [fdaines/arch-go](https://github.com/fdaines/arch-go)
* not unit test based: requires extra CLI tool
## Ideas
* Support checking of not using specific functions / classes of packages, e.g.,
"do not use fmt.Prinln", but some logging library instead.
## Open Problems
* Is Method Chaining really the best way for golang? How do we communicate errors? Fail on last call? Return nil?