From 4b27f1072a92763d0165010adb2bb07bae73f763 Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 08:40:50 +0000 Subject: [PATCH] refactor(forge): align config lookup and service docs with AX Co-Authored-By: Virgil --- config.go | 5 +- service_string.go | 200 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 21e88cd..5f79fa7 100644 --- a/config.go +++ b/config.go @@ -4,7 +4,6 @@ import ( "encoding/json" "os" "path/filepath" - "syscall" core "dappco.re/go/core" coreio "dappco.re/go/core/io" @@ -94,10 +93,10 @@ func ResolveConfig(flagURL, flagToken string) (url, token string, err error) { token = fileToken } - if envURL, ok := syscall.Getenv("FORGE_URL"); ok && envURL != "" { + if envURL, ok := os.LookupEnv("FORGE_URL"); ok && envURL != "" { url = envURL } - if envToken, ok := syscall.Getenv("FORGE_TOKEN"); ok && envToken != "" { + if envToken, ok := os.LookupEnv("FORGE_TOKEN"); ok && envToken != "" { token = envToken } diff --git a/service_string.go b/service_string.go index 9bb619c..c29476a 100644 --- a/service_string.go +++ b/service_string.go @@ -1,6 +1,11 @@ package forge // String returns a safe summary of the actions service. +// +// Usage: +// +// s := &forge.ActionsService{} +// _ = s.String() func (s *ActionsService) String() string { if s == nil { return "forge.ActionsService{}" @@ -9,9 +14,19 @@ func (s *ActionsService) String() string { } // GoString returns a safe Go-syntax summary of the actions service. +// +// Usage: +// +// s := &forge.ActionsService{} +// _ = fmt.Sprintf("%#v", s) func (s *ActionsService) GoString() string { return s.String() } // String returns a safe summary of the ActivityPub service. +// +// Usage: +// +// s := &forge.ActivityPubService{} +// _ = s.String() func (s *ActivityPubService) String() string { if s == nil { return "forge.ActivityPubService{}" @@ -20,9 +35,19 @@ func (s *ActivityPubService) String() string { } // GoString returns a safe Go-syntax summary of the ActivityPub service. +// +// Usage: +// +// s := &forge.ActivityPubService{} +// _ = fmt.Sprintf("%#v", s) func (s *ActivityPubService) GoString() string { return s.String() } // String returns a safe summary of the admin service. +// +// Usage: +// +// s := &forge.AdminService{} +// _ = s.String() func (s *AdminService) String() string { if s == nil { return "forge.AdminService{}" @@ -31,9 +56,19 @@ func (s *AdminService) String() string { } // GoString returns a safe Go-syntax summary of the admin service. +// +// Usage: +// +// s := &forge.AdminService{} +// _ = fmt.Sprintf("%#v", s) func (s *AdminService) GoString() string { return s.String() } // String returns a safe summary of the branch service. +// +// Usage: +// +// s := &forge.BranchService{} +// _ = s.String() func (s *BranchService) String() string { if s == nil { return "forge.BranchService{}" @@ -42,9 +77,19 @@ func (s *BranchService) String() string { } // GoString returns a safe Go-syntax summary of the branch service. +// +// Usage: +// +// s := &forge.BranchService{} +// _ = fmt.Sprintf("%#v", s) func (s *BranchService) GoString() string { return s.String() } // String returns a safe summary of the commit service. +// +// Usage: +// +// s := &forge.CommitService{} +// _ = s.String() func (s *CommitService) String() string { if s == nil { return "forge.CommitService{}" @@ -53,9 +98,19 @@ func (s *CommitService) String() string { } // GoString returns a safe Go-syntax summary of the commit service. +// +// Usage: +// +// s := &forge.CommitService{} +// _ = fmt.Sprintf("%#v", s) func (s *CommitService) GoString() string { return s.String() } // String returns a safe summary of the content service. +// +// Usage: +// +// s := &forge.ContentService{} +// _ = s.String() func (s *ContentService) String() string { if s == nil { return "forge.ContentService{}" @@ -64,9 +119,19 @@ func (s *ContentService) String() string { } // GoString returns a safe Go-syntax summary of the content service. +// +// Usage: +// +// s := &forge.ContentService{} +// _ = fmt.Sprintf("%#v", s) func (s *ContentService) GoString() string { return s.String() } // String returns a safe summary of the issue service. +// +// Usage: +// +// s := &forge.IssueService{} +// _ = s.String() func (s *IssueService) String() string { if s == nil { return "forge.IssueService{}" @@ -75,9 +140,19 @@ func (s *IssueService) String() string { } // GoString returns a safe Go-syntax summary of the issue service. +// +// Usage: +// +// s := &forge.IssueService{} +// _ = fmt.Sprintf("%#v", s) func (s *IssueService) GoString() string { return s.String() } // String returns a safe summary of the label service. +// +// Usage: +// +// s := &forge.LabelService{} +// _ = s.String() func (s *LabelService) String() string { if s == nil { return "forge.LabelService{}" @@ -86,9 +161,19 @@ func (s *LabelService) String() string { } // GoString returns a safe Go-syntax summary of the label service. +// +// Usage: +// +// s := &forge.LabelService{} +// _ = fmt.Sprintf("%#v", s) func (s *LabelService) GoString() string { return s.String() } // String returns a safe summary of the milestone service. +// +// Usage: +// +// s := &forge.MilestoneService{} +// _ = s.String() func (s *MilestoneService) String() string { if s == nil { return "forge.MilestoneService{}" @@ -97,9 +182,19 @@ func (s *MilestoneService) String() string { } // GoString returns a safe Go-syntax summary of the milestone service. +// +// Usage: +// +// s := &forge.MilestoneService{} +// _ = fmt.Sprintf("%#v", s) func (s *MilestoneService) GoString() string { return s.String() } // String returns a safe summary of the misc service. +// +// Usage: +// +// s := &forge.MiscService{} +// _ = s.String() func (s *MiscService) String() string { if s == nil { return "forge.MiscService{}" @@ -108,9 +203,19 @@ func (s *MiscService) String() string { } // GoString returns a safe Go-syntax summary of the misc service. +// +// Usage: +// +// s := &forge.MiscService{} +// _ = fmt.Sprintf("%#v", s) func (s *MiscService) GoString() string { return s.String() } // String returns a safe summary of the notification service. +// +// Usage: +// +// s := &forge.NotificationService{} +// _ = s.String() func (s *NotificationService) String() string { if s == nil { return "forge.NotificationService{}" @@ -119,9 +224,19 @@ func (s *NotificationService) String() string { } // GoString returns a safe Go-syntax summary of the notification service. +// +// Usage: +// +// s := &forge.NotificationService{} +// _ = fmt.Sprintf("%#v", s) func (s *NotificationService) GoString() string { return s.String() } // String returns a safe summary of the organisation service. +// +// Usage: +// +// s := &forge.OrgService{} +// _ = s.String() func (s *OrgService) String() string { if s == nil { return "forge.OrgService{}" @@ -130,9 +245,19 @@ func (s *OrgService) String() string { } // GoString returns a safe Go-syntax summary of the organisation service. +// +// Usage: +// +// s := &forge.OrgService{} +// _ = fmt.Sprintf("%#v", s) func (s *OrgService) GoString() string { return s.String() } // String returns a safe summary of the package service. +// +// Usage: +// +// s := &forge.PackageService{} +// _ = s.String() func (s *PackageService) String() string { if s == nil { return "forge.PackageService{}" @@ -141,9 +266,19 @@ func (s *PackageService) String() string { } // GoString returns a safe Go-syntax summary of the package service. +// +// Usage: +// +// s := &forge.PackageService{} +// _ = fmt.Sprintf("%#v", s) func (s *PackageService) GoString() string { return s.String() } // String returns a safe summary of the pull request service. +// +// Usage: +// +// s := &forge.PullService{} +// _ = s.String() func (s *PullService) String() string { if s == nil { return "forge.PullService{}" @@ -152,9 +287,19 @@ func (s *PullService) String() string { } // GoString returns a safe Go-syntax summary of the pull request service. +// +// Usage: +// +// s := &forge.PullService{} +// _ = fmt.Sprintf("%#v", s) func (s *PullService) GoString() string { return s.String() } // String returns a safe summary of the release service. +// +// Usage: +// +// s := &forge.ReleaseService{} +// _ = s.String() func (s *ReleaseService) String() string { if s == nil { return "forge.ReleaseService{}" @@ -163,9 +308,19 @@ func (s *ReleaseService) String() string { } // GoString returns a safe Go-syntax summary of the release service. +// +// Usage: +// +// s := &forge.ReleaseService{} +// _ = fmt.Sprintf("%#v", s) func (s *ReleaseService) GoString() string { return s.String() } // String returns a safe summary of the repository service. +// +// Usage: +// +// s := &forge.RepoService{} +// _ = s.String() func (s *RepoService) String() string { if s == nil { return "forge.RepoService{}" @@ -174,9 +329,19 @@ func (s *RepoService) String() string { } // GoString returns a safe Go-syntax summary of the repository service. +// +// Usage: +// +// s := &forge.RepoService{} +// _ = fmt.Sprintf("%#v", s) func (s *RepoService) GoString() string { return s.String() } // String returns a safe summary of the team service. +// +// Usage: +// +// s := &forge.TeamService{} +// _ = s.String() func (s *TeamService) String() string { if s == nil { return "forge.TeamService{}" @@ -185,9 +350,19 @@ func (s *TeamService) String() string { } // GoString returns a safe Go-syntax summary of the team service. +// +// Usage: +// +// s := &forge.TeamService{} +// _ = fmt.Sprintf("%#v", s) func (s *TeamService) GoString() string { return s.String() } // String returns a safe summary of the user service. +// +// Usage: +// +// s := &forge.UserService{} +// _ = s.String() func (s *UserService) String() string { if s == nil { return "forge.UserService{}" @@ -196,9 +371,19 @@ func (s *UserService) String() string { } // GoString returns a safe Go-syntax summary of the user service. +// +// Usage: +// +// s := &forge.UserService{} +// _ = fmt.Sprintf("%#v", s) func (s *UserService) GoString() string { return s.String() } // String returns a safe summary of the webhook service. +// +// Usage: +// +// s := &forge.WebhookService{} +// _ = s.String() func (s *WebhookService) String() string { if s == nil { return "forge.WebhookService{}" @@ -207,9 +392,19 @@ func (s *WebhookService) String() string { } // GoString returns a safe Go-syntax summary of the webhook service. +// +// Usage: +// +// s := &forge.WebhookService{} +// _ = fmt.Sprintf("%#v", s) func (s *WebhookService) GoString() string { return s.String() } // String returns a safe summary of the wiki service. +// +// Usage: +// +// s := &forge.WikiService{} +// _ = s.String() func (s *WikiService) String() string { if s == nil { return "forge.WikiService{}" @@ -218,4 +413,9 @@ func (s *WikiService) String() string { } // GoString returns a safe Go-syntax summary of the wiki service. +// +// Usage: +// +// s := &forge.WikiService{} +// _ = fmt.Sprintf("%#v", s) func (s *WikiService) GoString() string { return s.String() }