From 328fe33ce5dc4d7ba26efe1b1b24bcda7e765f7e Mon Sep 17 00:00:00 2001 From: Vitor Hugo Date: Fri, 8 Sep 2023 23:08:14 -0300 Subject: [PATCH] :pencil: (DOCS) Fix typo on docs --- README.md | 58 +++++++++++----------- dist/config.yaml | 125 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 29 deletions(-) create mode 100644 dist/config.yaml diff --git a/README.md b/README.md index 3648bb0..8c98b83 100644 --- a/README.md +++ b/README.md @@ -28,35 +28,6 @@ Zeus detects and reports cycles in your dependencies to prevent runtime errors. Zeus supports lifecycle hooks, allowing you to execute functions at the start and end of your application. This is especially useful for setups and teardowns, like establishing a database connection or gracefully shutting down services. -### 🔄 Merging Containers - -Zeus now supports merging two containers together using the Merge method. This is especially useful when you have modularized your application and want to combine dependencies from different modules. - -#### How to Use - -1. Create two separate containers. -2. Add factories to both containers. -3. Use the Merge method to combine the factories of one container into another. - -#### Example - -```go -containerA := zeus.New() -containerB := zeus.New() - -containerA.Provide(func() string { return "Hello" }) -containerB.Provide(func() int { return 42 }) - -err := containerA.Merge(containerB) -if err != nil { - // Handle merge error -} -``` - -#### Note - -If a factory from the merging container conflicts with an existing factory in the main container, and they are not identical, a FactoryAlreadyProvidedError will be returned. This ensures that you don't accidentally overwrite existing dependencies. - ## 🚀 Getting Started ### Installation @@ -126,6 +97,35 @@ c.Run(func(s *Service) { ``` +### Merging Containers + +Zeus now supports merging two containers together using the Merge method. This is especially useful when you have modularized your application and want to combine dependencies from different modules. + +#### How to Use + +1. Create two separate containers. +2. Add factories to both containers. +3. Use the Merge method to combine the factories of one container into another. + +#### Example + +```go +containerA := zeus.New() +containerB := zeus.New() + +containerA.Provide(func() string { return "Hello" }) +containerB.Provide(func() int { return 42 }) + +err := containerA.Merge(containerB) +if err != nil { + // Handle merge error +} +``` + +#### Note + +If a factory from the merging container conflicts with an existing factory in the main container, and they are not identical, a `FactoryAlreadyProvidedError` will be returned. This ensures that you don't accidentally overwrite existing dependencies. + ### Error Handling Zeus uses `ErrorSet` to aggregate multiple errors. This is especially useful when multiple errors occur during the lifecycle of your application, such as during dependency resolution or hook execution. diff --git a/dist/config.yaml b/dist/config.yaml new file mode 100644 index 0000000..14a74db --- /dev/null +++ b/dist/config.yaml @@ -0,0 +1,125 @@ +project_name: zeus +release: + github: + owner: Otoru + name: zeus + name_template: '{{.Tag}}' +builds: + - id: zeus + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + - "386" + goarm: + - "6" + gomips: + - hardfloat + goamd64: + - v1 + targets: + - linux_amd64_v1 + - linux_arm64 + - linux_386 + - windows_amd64_v1 + - windows_arm64 + - windows_386 + - darwin_amd64_v1 + - darwin_arm64 + dir: . + main: . + binary: zeus + builder: go + gobinary: go + command: build + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser + env: + - CGO_ENABLED=0 +archives: + - id: default + name_template: '{{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }}' + format: tar.gz + format_overrides: + - goos: windows + format: zip + files: + - src: license* + - src: LICENSE* + - src: readme* + - src: README* + - src: changelog* + - src: CHANGELOG* +snapshot: + name_template: '{{ incpatch .Version }}-next' +checksum: + name_template: checksums.txt + algorithm: sha256 +changelog: + filters: + exclude: + - '^docs:' + - '^test:' + sort: asc +dist: dist +env_files: + github_token: ~/.config/goreleaser/github_token + gitlab_token: ~/.config/goreleaser/gitlab_token + gitea_token: ~/.config/goreleaser/gitea_token +before: + hooks: + - go mod tidy +source: + name_template: '{{ .ProjectName }}-{{ .Version }}' + format: tar.gz +gomod: + gobinary: go +announce: + twitter: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + mastodon: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + server: "" + reddit: + title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + url_template: '{{ .ReleaseURL }}' + slack: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + username: GoReleaser + discord: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + author: GoReleaser + color: "3888754" + icon_url: https://goreleaser.com/static/avatar.png + teams: + title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + color: '#2D313E' + icon_url: https://goreleaser.com/static/avatar.png + smtp: + subject_template: '{{ .ProjectName }} {{ .Tag }} is out!' + body_template: 'You can view details from: {{ .ReleaseURL }}' + mattermost: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + title_template: '{{ .ProjectName }} {{ .Tag }} is out!' + username: GoReleaser + linkedin: + message_template: '{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}' + telegram: + message_template: '{{ .ProjectName }} {{ mdv2escape .Tag }} is out! Check it out at {{ mdv2escape .ReleaseURL }}' + parse_mode: MarkdownV2 + webhook: + message_template: '{ "message": "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"}' + content_type: application/json; charset=utf-8 + opencollective: + title_template: '{{ .Tag }}' + message_template: '{{ .ProjectName }} {{ .Tag }} is out!
Check it out at {{ .ReleaseURL }}' +git: + tag_sort: -version:refname +github_urls: + download: https://github.com +gitlab_urls: + download: https://gitlab.com