{"id":36447409,"url":"https://github.com/actforgood/xdi","last_synced_at":"2026-02-14T17:15:16.990Z","repository":{"id":57695001,"uuid":"488571617","full_name":"actforgood/xdi","owner":"actforgood","description":"Golang Dependency Injection Package","archived":false,"fork":false,"pushed_at":"2025-12-15T17:02:39.000Z","size":60,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-12T00:27:04.424Z","etag":null,"topics":["dependency-injection","go","xdi"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actforgood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-05-04T12:03:07.000Z","updated_at":"2025-10-08T07:34:28.000Z","dependencies_parsed_at":"2023-11-07T01:09:43.297Z","dependency_job_id":"63d1acd1-d009-43f2-9eb0-a5059f2e6d4c","html_url":"https://github.com/actforgood/xdi","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/actforgood/xdi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actforgood%2Fxdi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actforgood%2Fxdi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actforgood%2Fxdi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actforgood%2Fxdi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actforgood","download_url":"https://codeload.github.com/actforgood/xdi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actforgood%2Fxdi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29450845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dependency-injection","go","xdi"],"created_at":"2026-01-11T22:48:22.809Z","updated_at":"2026-02-14T17:15:16.985Z","avatar_url":"https://github.com/actforgood.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xdi\n\n[![Build Status](https://github.com/actforgood/xdi/actions/workflows/build.yml/badge.svg)](https://github.com/actforgood/xdi/actions/workflows/build.yml)\n[![License](https://img.shields.io/badge/license-MIT-blue)](https://raw.githubusercontent.com/actforgood/xdi/main/LICENSE)\n[![Coverage Status](https://coveralls.io/repos/github/actforgood/xdi/badge.svg?branch=main)](https://coveralls.io/github/actforgood/xdi?branch=main)\n[![Goreportcard](https://goreportcard.com/badge/github.com/actforgood/xdi)](https://goreportcard.com/report/github.com/actforgood/xdi)\n[![Go Reference](https://pkg.go.dev/badge/github.com/actforgood/xdi.svg)](https://pkg.go.dev/github.com/actforgood/xdi)  \n\n---\n\nPackage `xdi` provides a centralized dependency injection manager which holds definitions for an application's objects/dependencies.  \n\n\n### Installation\n\n```shell\n$ go get github.com/actforgood/xdi\n```\n\n\n### Example\nBasic example:  \n```go\n// DiManager holds application's objects, dependencies.\n// Do not inject it/use it directly, in your application's objects.\n// It should be used only in the bootstrap process of your application and/or main.go,\n// as a centralized container of dependencies.\n// Note: instead of declaring a variable, you can also use the singleton provided by xdi.ManagerInstance().\nvar DiManager = xdi.NewManager()\n\nfunc init() {\n\tDiManager.AddDefinition(xdi.Definition{\n\t\tID: \"app.repository.product\",\n\t\tInitializer: func() any {\n\t\t\treturn NewDummyProductRepository()\n\t\t},\n\t\tShared: true,\n\t})\n}\n\nfunc init() {\n\tDiManager.AddDefinition(xdi.Definition{\n\t\tID: \"app.service.product\",\n\t\tInitializer: func() any {\n\t\t\treturn NewDummyProductService(\n\t\t\t\tDiManager.Get(\"app.repository.product\").(ProductRepository),\n\t\t\t)\n\t\t},\n\t\tShared: true,\n\t})\n}\n\nfunc main() {\n\tproductService := DiManager.Get(\"app.service.product\").(ProductService)\n\tisAvailable, _ := productService.CheckAvailability(\"some-sku\", 2)\n\tfmt.Println(\"isAvailable:\", isAvailable)\n}\n```\n\n\n### Misc \nFeel free to use this pkg if you like it and fits your needs.   \nAs it is a light/lite pkg, you can also just copy-paste the code, instead of importing it, keeping the license header.  \n\n\n### License\nThis package is released under a MIT license. See [LICENSE](LICENSE).  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factforgood%2Fxdi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factforgood%2Fxdi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factforgood%2Fxdi/lists"}