{"id":37991634,"url":"https://github.com/defrankland/gaop","last_synced_at":"2026-01-16T18:43:58.201Z","repository":{"id":57520506,"uuid":"71036014","full_name":"defrankland/gaop","owner":"defrankland","description":"Aspect-oriented programming package for go","archived":false,"fork":false,"pushed_at":"2017-07-17T03:50:35.000Z","size":16,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T12:07:14.305Z","etag":null,"topics":["aop","aspect-oriented-programming","golang"],"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/defrankland.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}},"created_at":"2016-10-16T07:20:29.000Z","updated_at":"2022-02-22T08:53:56.000Z","dependencies_parsed_at":"2022-09-26T18:00:59.933Z","dependency_job_id":null,"html_url":"https://github.com/defrankland/gaop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/defrankland/gaop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defrankland%2Fgaop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defrankland%2Fgaop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defrankland%2Fgaop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defrankland%2Fgaop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/defrankland","download_url":"https://codeload.github.com/defrankland/gaop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defrankland%2Fgaop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: 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":["aop","aspect-oriented-programming","golang"],"created_at":"2026-01-16T18:43:58.130Z","updated_at":"2026-01-16T18:43:58.192Z","avatar_url":"https://github.com/defrankland.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gaop\n\nAspect-oriented Programming library for golang. \n\n## Current State \n\nSupports advice types \n- Before\n- After\n- After returning\n\nCurrently it is a slight bummer to create a pointcut. The method to do so takes both the pointcut methodName as a string and the pointcut method itself (as an interface{}):\n\n```go\nAddPointcut(methodName string, adviceType AopAdviceType, i, pointcut interface{}) (err error)\n``` \n\n# Usage:\n\nSee tests for intended modes of operation.\n\nIntended usage is to create a type where the methods map to fields like this: \n\n```go\ntype Doggo struct {\n\tBark   func(int, bool) error\n\taspect gaop.Aspect\n}\n\nfunc (d *Doggo) BarkImpl(numBarks int, gotChokedUp bool) error {\n\n\tif gotChokedUp {\n\t\treturn errors.New(\"failed to bark.\")\n\t}\n\n\tfmt.Println(strings.Repeat(\"BARK!! \", numBarks))\n\n\treturn nil\n}\n```\n\nNext create some advice (note the type is `ADVICE_BEFORE`): \n\n```go\nfunc openMouth() {\n\tfmt.Println(\"Opening Mouth...\")\n}\n```\n\n\nMap the method to the field and add the advice: \n\n```go\nfunc NewDoggo() *Doggo {\n\n\tdoggo := Doggo{}\n\tdoggo.Bark = doggo.BarkImpl\n\n\tdoggo.aspect.AddAdvice(openMouth, gaop.ADVICE_BEFORE)\n\tdoggo.aspect.AddPointcut(\"BarkImpl\", gaop.ADVICE_BEFORE, \u0026doggo, \u0026doggo.Bark)\n\n\treturn \u0026doggo\n}\n```\n\nNow run:\n\n```go\nfunc main() {\n\n\tdoggo := NewDoggo()\n\n\terr := doggo.Bark(5, false)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n}\n```\n\nNote that `Bark()` is called, not `BarkImpl()`. \n\nGives the output:\n```\n⇒  go run main.go\nOpening Mouth...\nBARK!!\n```\n\n## Advice Type Constants\n- `ADVICE_BEFORE`\n- `ADVICE_AFTER`\n- `ADVICE_AFTER_RETURNING`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefrankland%2Fgaop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefrankland%2Fgaop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefrankland%2Fgaop/lists"}