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

View File

@ -13,7 +13,7 @@ type IssueDependency struct {
ID int64 `xorm:"pk autoincr"`
UserID 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:"-"`
CreatedUnix int64 `xorm:"NOT NULL"`
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
func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) {
func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) {
issueDeps, err := repo.getBlockedByDependencies(x, issueID)
var issueDepsFull = make([]*Issue, 0)
for _, issueDep := range issueDeps{
for _, issueDep := range issueDeps {
issueDetails, _ := getIssueByID(x, issueDep.DependencyID)
issueDepsFull = append(issueDepsFull, issueDetails)
}
@ -711,12 +711,12 @@ func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err e
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)
var issueDepsFull = make([]*Issue, 0)
for _, issueDep := range issueDeps{
for _, issueDep := range issueDeps {
issueDetails, _ := getIssueByID(x, issueDep.IssueID)
issueDepsFull = append(issueDepsFull, issueDetails)
}
@ -727,6 +727,7 @@ func (repo *Repository) BlockingDependencies(issueID int64) (_ []*Issue, err er
return issueDepsFull, nil
}
// NextIssueIndex returns the next issue index
// FIXME: should have a mutex to prevent producing same index for two issues that are created
// closely enough.

View File

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

View File

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

View File

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

View File

@ -684,8 +684,8 @@ func ViewIssue(ctx *context.Context) {
ctx.Handle(500, "LoadAssignees", err)
return
}
} else if comment.Type == models.CommentTypeRemovedDependency || comment.Type == models.CommentTypeAddedDependency{
if err = comment.LoadDepIssueDetails(); err != nil{
} else if comment.Type == models.CommentTypeRemovedDependency || comment.Type == models.CommentTypeAddedDependency {
if err = comment.LoadDepIssueDetails(); err != nil {
ctx.Handle(http.StatusInternalServerError, "LoadDepIssueDetails", err)
return
}
@ -920,12 +920,12 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
!(issue.IsPull && issue.PullRequest.HasMerged) {
// Check for open dependencies
if form.Status == "close"{
if form.Status == "close" {
canbeClosed := models.IssueNoDependenciesLeft(issue)
canbeClosed := models.IssueNoDependenciesLeft(issue.ID)
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.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index))
} else {

View File

@ -45,7 +45,7 @@ func AddDependency(c *context.Context) {
}
// 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"))
} else {

View File

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

View File

@ -428,7 +428,7 @@ func MergePullRequest(ctx *context.Context) {
pr.Issue = issue
pr.Issue.Repo = ctx.Repo.Repository
canbeClosed := models.IssueNoDependenciesLeft(issue)
canbeClosed := models.IssueNoDependenciesLeft(issue.ID)
if !canbeClosed {
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{
RepoID: repo.ID,
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 && ./postgres.sh
post:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)