Fixing build process by syncing govendor dependencies and gofmt.

Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
Jonas Franz 2017-09-17 21:26:37 +02:00
parent 05ad1bb4a8
commit fe6c1a9ae2
13 changed files with 88 additions and 88 deletions

View File

@ -473,7 +473,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
} }
// Check for dependencies, if there aren't any, close it // Check for dependencies, if there aren't any, close it
canbeClosed := IssueNoDependenciesLeft(issue) canbeClosed := IssueNoDependenciesLeft(issue.ID)
if canbeClosed { if canbeClosed {
if err = issue.ChangeStatus(doer, repo, true); err != nil { if err = issue.ChangeStatus(doer, repo, true); err != nil {

View File

@ -79,25 +79,25 @@ const (
// Comment represents a comment in commit and issue page. // Comment represents a comment in commit and issue page.
type Comment struct { type Comment struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
Type CommentType Type CommentType
PosterID int64 `xorm:"INDEX"` PosterID int64 `xorm:"INDEX"`
Poster *User `xorm:"-"` Poster *User `xorm:"-"`
IssueID int64 `xorm:"INDEX"` IssueID int64 `xorm:"INDEX"`
LabelID int64 LabelID int64
Label *Label `xorm:"-"` Label *Label `xorm:"-"`
OldMilestoneID int64 OldMilestoneID int64
MilestoneID int64 MilestoneID int64
OldMilestone *Milestone `xorm:"-"` OldMilestone *Milestone `xorm:"-"`
Milestone *Milestone `xorm:"-"` Milestone *Milestone `xorm:"-"`
OldAssigneeID int64 OldAssigneeID int64
AssigneeID int64 AssigneeID int64
Assignee *User `xorm:"-"` Assignee *User `xorm:"-"`
OldAssignee *User `xorm:"-"` OldAssignee *User `xorm:"-"`
OldTitle string OldTitle string
NewTitle string NewTitle string
DependentIssueID int64 DependentIssueID int64
DependentIssue *Issue `xorm:"-"` DependentIssue *Issue `xorm:"-"`
CommitID int64 CommitID int64
Line int64 Line int64
@ -322,23 +322,23 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
} }
comment := &Comment{ comment := &Comment{
Type: opts.Type, Type: opts.Type,
PosterID: opts.Doer.ID, PosterID: opts.Doer.ID,
Poster: opts.Doer, Poster: opts.Doer,
IssueID: opts.Issue.ID, IssueID: opts.Issue.ID,
LabelID: LabelID, LabelID: LabelID,
OldMilestoneID: opts.OldMilestoneID, OldMilestoneID: opts.OldMilestoneID,
MilestoneID: opts.MilestoneID, MilestoneID: opts.MilestoneID,
OldAssigneeID: opts.OldAssigneeID, OldAssigneeID: opts.OldAssigneeID,
AssigneeID: opts.AssigneeID, AssigneeID: opts.AssigneeID,
CommitID: opts.CommitID, CommitID: opts.CommitID,
CommitSHA: opts.CommitSHA, CommitSHA: opts.CommitSHA,
Line: opts.LineNum, Line: opts.LineNum,
Content: opts.Content, Content: opts.Content,
OldTitle: opts.OldTitle, OldTitle: opts.OldTitle,
NewTitle: opts.NewTitle, NewTitle: opts.NewTitle,
DependentIssue: opts.DependentIssue, DependentIssue: opts.DependentIssue,
DependentIssueID: opts.DependentIssue.ID, DependentIssueID: depId,
} }
//fmt.Println(comment) //fmt.Println(comment)
@ -528,22 +528,22 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
} }
return createComment(e, &CreateCommentOptions{ return createComment(e, &CreateCommentOptions{
Type: cType, Type: cType,
Doer: doer, Doer: doer,
Repo: issue.Repo, Repo: issue.Repo,
Issue: issue, Issue: issue,
DependentIssue: dependantIssue, DependentIssue: dependantIssue,
Content: issue.Title, Content: issue.Title,
}) })
} }
// CreateCommentOptions defines options for creating comment // CreateCommentOptions defines options for creating comment
type CreateCommentOptions struct { type CreateCommentOptions struct {
Type CommentType Type CommentType
Doer *User Doer *User
Repo *Repository Repo *Repository
Issue *Issue Issue *Issue
Label *Label Label *Label
DependentIssue *Issue DependentIssue *Issue
OldMilestoneID int64 OldMilestoneID int64

View File

@ -13,7 +13,7 @@ type IssueDependency struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
UserID int64 `xorm:"UNIQUE(watch) NOT NULL"` UserID int64 `xorm:"UNIQUE(watch) NOT NULL"`
IssueID int64 `xorm:"UNIQUE(watch) NOT NULL"` IssueID int64 `xorm:"UNIQUE(watch) NOT NULL"`
DependencyID int64 `xorm:"UNIQUE(watch) NOT NULL"` DependencyID int64 `xorm:"UNIQUE(watch) NOT NULL"`
Created time.Time `xorm:"-"` Created time.Time `xorm:"-"`
CreatedUnix int64 `xorm:"NOT NULL"` CreatedUnix int64 `xorm:"NOT NULL"`
Updated time.Time `xorm:"-"` Updated time.Time `xorm:"-"`

View File

@ -694,12 +694,12 @@ func (repo *Repository) getUsersWithAccessMode(e Engine, mode AccessMode) (_ []*
} }
// Find all Dependencies an issue is blocked by // Find all Dependencies an issue is blocked by
func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) { func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) {
issueDeps, err := repo.getBlockedByDependencies(x, issueID) issueDeps, err := repo.getBlockedByDependencies(x, issueID)
var issueDepsFull = make([]*Issue, 0) var issueDepsFull = make([]*Issue, 0)
for _, issueDep := range issueDeps{ for _, issueDep := range issueDeps {
issueDetails, _ := getIssueByID(x, issueDep.DependencyID) issueDetails, _ := getIssueByID(x, issueDep.DependencyID)
issueDepsFull = append(issueDepsFull, issueDetails) issueDepsFull = append(issueDepsFull, issueDetails)
} }
@ -711,12 +711,12 @@ func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err e
return issueDepsFull, nil return issueDepsFull, nil
} }
func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err error) { func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err error) {
issueDeps, err := repo.getBlockingDependencies(x, issueID) issueDeps, err := repo.getBlockingDependencies(x, issueID)
var issueDepsFull = make([]*Issue, 0) var issueDepsFull = make([]*Issue, 0)
for _, issueDep := range issueDeps{ for _, issueDep := range issueDeps {
issueDetails, _ := getIssueByID(x, issueDep.IssueID) issueDetails, _ := getIssueByID(x, issueDep.IssueID)
issueDepsFull = append(issueDepsFull, issueDetails) issueDepsFull = append(issueDepsFull, issueDetails)
} }
@ -727,6 +727,7 @@ func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err er
return issueDepsFull, nil return issueDepsFull, nil
} }
// NextIssueIndex returns the next issue index // NextIssueIndex returns the next issue index
// FIXME: should have a mutex to prevent producing same index for two issues that are created // FIXME: should have a mutex to prevent producing same index for two issues that are created
// closely enough. // closely enough.

View File

@ -150,7 +150,7 @@ func (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig {
} }
// IssueDependenciesConfig returns config for UnitTypeIssueDependencies // IssueDependenciesConfig returns config for UnitTypeIssueDependencies
func (r *RepoUnit) IssueDependenciesConfig() *UnitConfig{ func (r *RepoUnit) IssueDependenciesConfig() *UnitConfig {
return r.Config.(*UnitConfig) return r.Config.(*UnitConfig)
} }

View File

@ -9,14 +9,14 @@ type UnitType int
// Enumerate all the unit types // Enumerate all the unit types
const ( const (
UnitTypeCode UnitType = iota + 1 // 1 code UnitTypeCode UnitType = iota + 1 // 1 code
UnitTypeIssues // 2 issues UnitTypeIssues // 2 issues
UnitTypePullRequests // 3 PRs UnitTypePullRequests // 3 PRs
UnitTypeReleases // 4 Releases UnitTypeReleases // 4 Releases
UnitTypeWiki // 5 Wiki UnitTypeWiki // 5 Wiki
UnitTypeExternalWiki // 6 ExternalWiki UnitTypeExternalWiki // 6 ExternalWiki
UnitTypeExternalTracker // 7 ExternalTracker UnitTypeExternalTracker // 7 ExternalTracker
UnitTypeIssueDependencies // 8 Issue Dependencies UnitTypeIssueDependencies // 8 Issue Dependencies
) )
var ( var (
@ -130,13 +130,13 @@ var (
// Units contains all the units // Units contains all the units
Units = map[UnitType]Unit{ Units = map[UnitType]Unit{
UnitTypeCode: UnitCode, UnitTypeCode: UnitCode,
UnitTypeIssues: UnitIssues, UnitTypeIssues: UnitIssues,
UnitTypeExternalTracker: UnitExternalTracker, UnitTypeExternalTracker: UnitExternalTracker,
UnitTypePullRequests: UnitPullRequests, UnitTypePullRequests: UnitPullRequests,
UnitTypeReleases: UnitReleases, UnitTypeReleases: UnitReleases,
UnitTypeWiki: UnitWiki, UnitTypeWiki: UnitWiki,
UnitTypeExternalWiki: UnitExternalWiki, UnitTypeExternalWiki: UnitExternalWiki,
UnitTypeIssueDependencies: UnitIssueDependencies, UnitTypeIssueDependencies: UnitIssueDependencies,
} }
) )

View File

@ -95,19 +95,18 @@ type RepoSettingForm struct {
EnablePrune bool EnablePrune bool
// Advanced settings // Advanced settings
EnableWiki bool EnableWiki bool
EnableExternalWiki bool EnableExternalWiki bool
ExternalWikiURL string ExternalWikiURL string
EnableIssues bool EnableIssues bool
EnableExternalTracker bool EnableExternalTracker bool
ExternalTrackerURL string ExternalTrackerURL string
TrackerURLFormat string TrackerURLFormat string
TrackerIssueStyle string TrackerIssueStyle string
EnablePulls bool EnablePulls bool
EnableIssueDependencies bool
EnableTimetracker bool EnableTimetracker bool
AllowOnlyContributorsToTrackTime bool AllowOnlyContributorsToTrackTime bool
EnableIssueDependencies bool EnableIssueDependencies bool
} }
// Validate validates the fields // Validate validates the fields

View File

@ -684,8 +684,8 @@ func ViewIssue(ctx *context.Context) {
ctx.Handle(500, "LoadAssignees", err) ctx.Handle(500, "LoadAssignees", err)
return return
} }
} else if comment.Type == models.CommentTypeRemovedDependency || comment.Type == models.CommentTypeAddedDependency{ } else if comment.Type == models.CommentTypeRemovedDependency || comment.Type == models.CommentTypeAddedDependency {
if err = comment.LoadDepIssueDetails(); err != nil{ if err = comment.LoadDepIssueDetails(); err != nil {
ctx.Handle(http.StatusInternalServerError, "LoadDepIssueDetails", err) ctx.Handle(http.StatusInternalServerError, "LoadDepIssueDetails", err)
return return
} }
@ -920,12 +920,12 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
!(issue.IsPull && issue.PullRequest.HasMerged) { !(issue.IsPull && issue.PullRequest.HasMerged) {
// Check for open dependencies // Check for open dependencies
if form.Status == "close"{ if form.Status == "close" {
canbeClosed := models.IssueNoDependenciesLeft(issue) canbeClosed := models.IssueNoDependenciesLeft(issue.ID)
if !canbeClosed { if !canbeClosed {
if issue.IsPull{ if issue.IsPull {
ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!") ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!")
ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index)) ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index))
} else { } else {

View File

@ -45,7 +45,7 @@ func AddDependency(c *context.Context) {
} }
// Check if issue and dependency is the same // Check if issue and dependency is the same
if dep.Index == issueIndex{ if dep.Index == issueIndex {
c.Flash.Error(c.Tr("issues.dependency.add_error_same_issue")) c.Flash.Error(c.Tr("issues.dependency.add_error_same_issue"))
} else { } else {

View File

@ -36,7 +36,7 @@ func RemoveDependency(c *context.Context) {
return return
} }
if depType != 1 && depType != 2{ if depType != 1 && depType != 2 {
c.Handle(http.StatusBadRequest, "GetDependecyType", nil) c.Handle(http.StatusBadRequest, "GetDependecyType", nil)
return return
} }

View File

@ -428,7 +428,7 @@ func MergePullRequest(ctx *context.Context) {
pr.Issue = issue pr.Issue = issue
pr.Issue.Repo = ctx.Repo.Repository pr.Issue.Repo = ctx.Repo.Repository
canbeClosed := models.IssueNoDependenciesLeft(issue) canbeClosed := models.IssueNoDependenciesLeft(issue.ID)
if !canbeClosed { if !canbeClosed {
ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!") ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!")

View File

@ -219,7 +219,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
}) })
} }
if form.EnableIssueDependencies{ if form.EnableIssueDependencies {
units = append(units, models.RepoUnit{ units = append(units, models.RepoUnit{
RepoID: repo.ID, RepoID: repo.ID,
Type: models.UnitTypeIssueDependencies, Type: models.UnitTypeIssueDependencies,

View File

@ -35,4 +35,4 @@ test:
- cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./mysql.sh - cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./mysql.sh
- cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./postgres.sh - cd /home/ubuntu/.go_workspace/src/github.com/go-xorm/tests && ./postgres.sh
post: post:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)