浏览代码

remove unneeded struct entries. Minor linting fix

Jguer 7 年之前
父节点
当前提交
41c37153e5
共有 2 个文件被更改,包括 6 次插入120 次删除
  1. 2 2
      dependencies.go
  2. 4 118
      vcs.go

+ 2 - 2
dependencies.go

@@ -195,10 +195,10 @@ func repoTreeRecursive(pkg *alpm.Package, dt *depTree, localDb *alpm.Db, syncDb
 		if inRepos == nil {
 			repoTreeRecursive(repoPkg, dt, localDb, syncDb)
 			return
-		} else {
-			dt.Missing.set(dep.String())
 		}
 
+		dt.Missing.set(dep.String())
+
 		return
 	})
 

+ 4 - 118
vcs.go

@@ -7,7 +7,6 @@ import (
 	"net/http"
 	"os"
 	"strings"
-	"time"
 )
 
 // branch contains the information of a repository branch
@@ -15,7 +14,6 @@ type branch struct {
 	Name   string `json:"name"`
 	Commit struct {
 		SHA string `json:"sha"`
-		URL string `json:"url"`
 	} `json:"commit"`
 }
 
@@ -32,121 +30,9 @@ type infos []Info
 
 // Repo contains information about the repository
 type repo struct {
-	ID       int    `json:"id"`
-	Name     string `json:"name"`
-	FullName string `json:"full_name"`
-	Owner    struct {
-		Login             string `json:"login"`
-		ID                int    `json:"id"`
-		AvatarURL         string `json:"avatar_url"`
-		GravatarID        string `json:"gravatar_id"`
-		URL               string `json:"url"`
-		HTMLURL           string `json:"html_url"`
-		FollowersURL      string `json:"followers_url"`
-		FollowingURL      string `json:"following_url"`
-		GistsURL          string `json:"gists_url"`
-		StarredURL        string `json:"starred_url"`
-		SubscriptionsURL  string `json:"subscriptions_url"`
-		OrganizationsURL  string `json:"organizations_url"`
-		ReposURL          string `json:"repos_url"`
-		EventsURL         string `json:"events_url"`
-		ReceivedEventsURL string `json:"received_events_url"`
-		Type              string `json:"type"`
-		SiteAdmin         bool   `json:"site_admin"`
-	} `json:"owner"`
-	Private          bool        `json:"private"`
-	HTMLURL          string      `json:"html_url"`
-	Description      string      `json:"description"`
-	Fork             bool        `json:"fork"`
-	URL              string      `json:"url"`
-	ForksURL         string      `json:"forks_url"`
-	KeysURL          string      `json:"keys_url"`
-	CollaboratorsURL string      `json:"collaborators_url"`
-	TeamsURL         string      `json:"teams_url"`
-	HooksURL         string      `json:"hooks_url"`
-	IssueEventsURL   string      `json:"issue_events_url"`
-	EventsURL        string      `json:"events_url"`
-	AssigneesURL     string      `json:"assignees_url"`
-	BranchesURL      string      `json:"branches_url"`
-	TagsURL          string      `json:"tags_url"`
-	BlobsURL         string      `json:"blobs_url"`
-	GitTagsURL       string      `json:"git_tags_url"`
-	GitRefsURL       string      `json:"git_refs_url"`
-	TreesURL         string      `json:"trees_url"`
-	StatusesURL      string      `json:"statuses_url"`
-	LanguagesURL     string      `json:"languages_url"`
-	StargazersURL    string      `json:"stargazers_url"`
-	ContributorsURL  string      `json:"contributors_url"`
-	SubscribersURL   string      `json:"subscribers_url"`
-	SubscriptionURL  string      `json:"subscription_url"`
-	CommitsURL       string      `json:"commits_url"`
-	GitCommitsURL    string      `json:"git_commits_url"`
-	CommentsURL      string      `json:"comments_url"`
-	IssueCommentURL  string      `json:"issue_comment_url"`
-	ContentsURL      string      `json:"contents_url"`
-	CompareURL       string      `json:"compare_url"`
-	MergesURL        string      `json:"merges_url"`
-	ArchiveURL       string      `json:"archive_url"`
-	DownloadsURL     string      `json:"downloads_url"`
-	IssuesURL        string      `json:"issues_url"`
-	PullsURL         string      `json:"pulls_url"`
-	MilestonesURL    string      `json:"milestones_url"`
-	NotificationsURL string      `json:"notifications_url"`
-	LabelsURL        string      `json:"labels_url"`
-	ReleasesURL      string      `json:"releases_url"`
-	DeploymentsURL   string      `json:"deployments_url"`
-	CreatedAt        time.Time   `json:"created_at"`
-	UpdatedAt        time.Time   `json:"updated_at"`
-	PushedAt         time.Time   `json:"pushed_at"`
-	GitURL           string      `json:"git_url"`
-	SSHURL           string      `json:"ssh_url"`
-	CloneURL         string      `json:"clone_url"`
-	SvnURL           string      `json:"svn_url"`
-	Homepage         string      `json:"homepage"`
-	Size             int         `json:"size"`
-	StargazersCount  int         `json:"stargazers_count"`
-	WatchersCount    int         `json:"watchers_count"`
-	Language         string      `json:"language"`
-	HasIssues        bool        `json:"has_issues"`
-	HasProjects      bool        `json:"has_projects"`
-	HasDownloads     bool        `json:"has_downloads"`
-	HasWiki          bool        `json:"has_wiki"`
-	HasPages         bool        `json:"has_pages"`
-	ForksCount       int         `json:"forks_count"`
-	MirrorURL        interface{} `json:"mirror_url"`
-	Archived         bool        `json:"archived"`
-	OpenIssuesCount  int         `json:"open_issues_count"`
-	License          struct {
-		Key    string      `json:"key"`
-		Name   string      `json:"name"`
-		SpdxID interface{} `json:"spdx_id"`
-		URL    interface{} `json:"url"`
-	} `json:"license"`
-	Forks         int    `json:"forks"`
-	OpenIssues    int    `json:"open_issues"`
-	Watchers      int    `json:"watchers"`
+	Name          string `json:"name"`
+	FullName      string `json:"full_name"`
 	DefaultBranch string `json:"default_branch"`
-	Organization  struct {
-		Login             string `json:"login"`
-		ID                int    `json:"id"`
-		AvatarURL         string `json:"avatar_url"`
-		GravatarID        string `json:"gravatar_id"`
-		URL               string `json:"url"`
-		HTMLURL           string `json:"html_url"`
-		FollowersURL      string `json:"followers_url"`
-		FollowingURL      string `json:"following_url"`
-		GistsURL          string `json:"gists_url"`
-		StarredURL        string `json:"starred_url"`
-		SubscriptionsURL  string `json:"subscriptions_url"`
-		OrganizationsURL  string `json:"organizations_url"`
-		ReposURL          string `json:"repos_url"`
-		EventsURL         string `json:"events_url"`
-		ReceivedEventsURL string `json:"received_events_url"`
-		Type              string `json:"type"`
-		SiteAdmin         bool   `json:"site_admin"`
-	} `json:"organization"`
-	NetworkCount     int `json:"network_count"`
-	SubscribersCount int `json:"subscribers_count"`
 }
 
 // createDevelDB forces yay to create a DB of the existing development packages
@@ -255,9 +141,9 @@ func branchInfo(pkgName string, owner string, repoName string) (err error) {
 
 	_ = json.NewDecoder(repoResp.Body).Decode(&newRepo)
 	defaultBranch := newRepo.DefaultBranch
-	branchesUrl := url + "/branches"
+	branchesURL := url + "/branches"
 
-	branchResp, err := http.Get(branchesUrl)
+	branchResp, err := http.Get(branchesURL)
 	if err != nil {
 		return
 	}