From 0d03f5d0f8008bfafba6a6ed739958a5d26a6743 Mon Sep 17 00:00:00 2001 From: Luke Kysow Date: Sun, 2 Jul 2017 18:07:09 -0700 Subject: [PATCH] format --- server/command_handler.go | 9 +++++---- server/github_comment_renderer.go | 13 ++++++------- server/plan_executor.go | 1 - terraform/terraform_client.go | 3 ++- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/server/command_handler.go b/server/command_handler.go index f53f4039a..038975111 100644 --- a/server/command_handler.go +++ b/server/command_handler.go @@ -25,12 +25,13 @@ type CommandResponse struct { } type ProjectResult struct { - Path string - Error error - Failure string - PlanSuccess *PlanSuccess + Path string + Error error + Failure string + PlanSuccess *PlanSuccess ApplySuccess string } + func (p ProjectResult) Status() Status { if p.Error != nil { return Error diff --git a/server/github_comment_renderer.go b/server/github_comment_renderer.go index 9caedb22e..f5d6bd184 100644 --- a/server/github_comment_renderer.go +++ b/server/github_comment_renderer.go @@ -44,7 +44,7 @@ type GithubCommentRenderer struct{} type CommonData struct { Command string Verbose bool - Log string + Log string } type ErrData struct { @@ -62,7 +62,6 @@ type ResultData struct { CommonData } - func (g *GithubCommentRenderer) render(res CommandResponse, log string, verbose bool) string { commandStr := strings.Title(res.Command.String()) common := CommonData{commandStr, verbose, log} @@ -79,15 +78,15 @@ func (g *GithubCommentRenderer) renderProjectResults(pathResults []ProjectResult results := make(map[string]string) for _, result := range pathResults { if result.Error != nil { - results[result.Path] = g.renderTemplate(errTmpl, struct{ + results[result.Path] = g.renderTemplate(errTmpl, struct { Command string - Output string + Output string }{ Command: common.Command, - Output: result.Error.Error(), + Output: result.Error.Error(), }) } else if result.Failure != "" { - results[result.Path] = g.renderTemplate(failureTmpl, struct{ + results[result.Path] = g.renderTemplate(failureTmpl, struct { Command string Failure string }{ @@ -97,7 +96,7 @@ func (g *GithubCommentRenderer) renderProjectResults(pathResults []ProjectResult } else if result.PlanSuccess != nil { results[result.Path] = g.renderTemplate(planSuccessTmpl, *result.PlanSuccess) } else if result.ApplySuccess != "" { - results[result.Path] = g.renderTemplate(applySuccessTmpl, struct{Output string}{result.ApplySuccess}) + results[result.Path] = g.renderTemplate(applySuccessTmpl, struct{ Output string }{result.ApplySuccess}) } else { results[result.Path] = "Found no template. This is a bug!" } diff --git a/server/plan_executor.go b/server/plan_executor.go index ffc846cb0..4faa11dae 100644 --- a/server/plan_executor.go +++ b/server/plan_executor.go @@ -160,7 +160,6 @@ func (p *PlanExecutor) plan(ctx *CommandContext, repoDir string, project models. return ProjectResult{Error: err} } - // Run terraform plan ctx.Log.Info("running terraform plan in directory %q", project.Path) planFile := filepath.Join(repoDir, project.Path, fmt.Sprintf("%s.tfplan", tfEnv)) diff --git a/terraform/terraform_client.go b/terraform/terraform_client.go index 20fbe407c..6bdd38c42 100644 --- a/terraform/terraform_client.go +++ b/terraform/terraform_client.go @@ -5,9 +5,10 @@ import ( "os/exec" "regexp" + "strings" + version "github.com/hashicorp/go-version" "github.com/pkg/errors" - "strings" ) type Client struct {