internal/workflow:統一型別宣告,修復 #12 合併後 main 編譯失敗(#21)
#12 的 workflow.go 與 #13 的 types.go 各自宣告 User/Comment/Issue/
PullRequest/Repository,文字合併無衝突但語意衝突,main 自 a8c1f3e 起
go build 失敗。
統一採 #13 的字串模型(types.go 為唯一型別來源):
- Issue/Comment 補 State/Body/ClosedAt 欄位,新增 parseMoment
(對應 gitea.py _parse_iso8601;保留原時區偏移,輸出與 Python
isoformat 位元組一致)
- workflow.go 移除重複宣告,stalled/xref 邏輯改用該模型與 judge.go
既有輔助(AssigneeNames/ReviewerNames/LastComment/containsString)
- Source 介面 number 改 int64(與 types.go 對齊),cmd/xcheck 同步
- workflow_test.go 測試資料改新型別模型(字串時刻、指標欄位)
驗證:
- go build/go vet/go test ./... 全綠(#6 與 #7 案例皆未回歸)
- xcheck 對真實 API 並行掃描,stalled 輸出與 gitea.py 位元組一致(含
bear-cli#9 父追蹤項子項摘要、+08:00 時區偏移)
- xref 邊界案例(nope#9/PR#50 略過、bear-cli#9 內嵌解析)與 Python 一致
This commit is contained in:
+4
-4
@@ -132,8 +132,8 @@ func (s *apiSource) MyOrganizations() ([]string, error) {
|
||||
return names, nil
|
||||
}
|
||||
|
||||
func (s *apiSource) OrganizationRepositories(org string) ([]workflow.Repository, error) {
|
||||
var repos []workflow.Repository
|
||||
func (s *apiSource) OrganizationRepositories(org string) ([]workflow.Repo, error) {
|
||||
var repos []workflow.Repo
|
||||
if err := s.listAll("orgs/"+org+"/repos", nil, &repos); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -157,7 +157,7 @@ func (s *apiSource) OpenPulls(owner, repo string) ([]workflow.PullRequest, error
|
||||
return pulls, nil
|
||||
}
|
||||
|
||||
func (s *apiSource) IssueComments(owner, repo string, number int) ([]workflow.Comment, error) {
|
||||
func (s *apiSource) IssueComments(owner, repo string, number int64) ([]workflow.Comment, error) {
|
||||
var comments []workflow.Comment
|
||||
if err := s.listAll(fmt.Sprintf("repos/%s/%s/issues/%d/comments", owner, repo, number), nil, &comments); err != nil {
|
||||
return nil, err
|
||||
@@ -165,7 +165,7 @@ func (s *apiSource) IssueComments(owner, repo string, number int) ([]workflow.Co
|
||||
return comments, nil
|
||||
}
|
||||
|
||||
func (s *apiSource) TryGetIssue(owner, repo string, number int) (workflow.Issue, bool, error) {
|
||||
func (s *apiSource) TryGetIssue(owner, repo string, number int64) (workflow.Issue, bool, error) {
|
||||
var issue workflow.Issue
|
||||
body, code, err := s.get(fmt.Sprintf("repos/%s/%s/issues/%d", owner, repo, number), nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user