Skip to content

Commit

Permalink
Run go fmt for All code
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoet committed Jun 18, 2019
1 parent 163ecb0 commit a0cc632
Show file tree
Hide file tree
Showing 57 changed files with 139 additions and 142 deletions.
2 changes: 1 addition & 1 deletion cmd/config/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"

"github.com/fatih/color"
"github.com/spf13/cobra"
proctor_config "proctor/config"
"proctor/io"
"github.com/spf13/cobra"
)

func CreateDirIfNotExist(dir string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"path/filepath"

"github.com/fatih/color"
"github.com/spf13/cobra"
proctor_config "proctor/config"
"proctor/io"
"github.com/spf13/cobra"
)

func CreateDirIfNotExist(dir string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/description/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"strings"

"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
proc_metadata "proctor/proctord/jobs/metadata"
"github.com/spf13/cobra"
)

func NewCmd(printer io.Printer, proctorDClient daemon.Client) *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/execution/executioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"strings"

"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
proctord_utility "proctor/proctord/utility"
"github.com/spf13/cobra"
)

func NewCmd(printer io.Printer, proctorDClient daemon.Client, osExitFunc func(int)) *cobra.Command {
Expand Down Expand Up @@ -50,7 +50,7 @@ func NewCmd(printer io.Printer, proctorDClient daemon.Client, osExitFunc func(in
osExitFunc(1)
return
}

printer.Println("Proc submitted for execution. \nStreaming logs:", color.FgGreen)
err = proctorDClient.StreamProcLogs(executedProcName)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions cmd/execution/executioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"testing"

"github.com/fatih/color"
"proctor/daemon"
"proctor/io"
"proctor/proctord/utility"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"proctor/daemon"
"proctor/io"
"proctor/proctord/utility"
)

type ExecutionCmdTestSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/list/lister.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"

"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"proctor/utility/sort"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/list/lister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"testing"

"github.com/fatih/color"
"proctor/daemon"
"proctor/io"
proc_metadata "proctor/proctord/jobs/metadata"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"proctor/daemon"
"proctor/io"
proc_metadata "proctor/proctord/jobs/metadata"
)

type ListCmdTestSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package cmd

import (
"fmt"
"proctor/cmd/schedule/remove"
"os"
"proctor/cmd/schedule/remove"

"proctor/cmd/config"
"proctor/cmd/config/view"
"proctor/cmd/description"
"proctor/cmd/execution"
"proctor/cmd/list"
"proctor/cmd/schedule"
schedule_list "proctor/cmd/schedule/list"
schedule_describe "proctor/cmd/schedule/describe"
schedule_list "proctor/cmd/schedule/list"
"proctor/cmd/version"
"proctor/daemon"
"proctor/io"
Expand Down
4 changes: 2 additions & 2 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package cmd
import (
"testing"

"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"proctor/cmd/version/github"
"proctor/daemon"
"proctor/io"
)

func TestRootCmdUsage(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/schedule/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package describe
import (
"fmt"
"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
)

func NewCmd(printer io.Printer, proctorDClient daemon.Client) *cobra.Command {
Expand Down
12 changes: 6 additions & 6 deletions cmd/schedule/describe/describe_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package describe

import (
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"proctor/daemon"
"proctor/io"
"testing"
"github.com/stretchr/testify/assert"
)

type ScheduleCreateCmdTestSuite struct {
suite.Suite
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleDescribeCmd *cobra.Command
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleDescribeCmd *cobra.Command
}

func (s *ScheduleCreateCmdTestSuite) SetupTest() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/schedule/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"

"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
)

func NewCmd(printer io.Printer, proctorDClient daemon.Client) *cobra.Command {
Expand All @@ -25,7 +25,7 @@ func NewCmd(printer io.Printer, proctorDClient daemon.Client) *cobra.Command {

printer.Println(fmt.Sprintf("%-40s %-30s %-20s %s", "ID", "PROC NAME", "GROUP NAME", "TAGS"), color.FgGreen)
for _, scheduledProc := range scheduledProcs {
printer.Println(fmt.Sprintf("%-40s %-30s %-20s %s", scheduledProc.ID, scheduledProc.Name, scheduledProc.Group,scheduledProc.Tags), color.Reset)
printer.Println(fmt.Sprintf("%-40s %-30s %-20s %s", scheduledProc.ID, scheduledProc.Name, scheduledProc.Group, scheduledProc.Tags), color.Reset)
}
},
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/schedule/list/list_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package list

import (
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"proctor/daemon"
"proctor/io"
"testing"
"github.com/stretchr/testify/assert"
)

type ScheduleCreateCmdTestSuite struct {
suite.Suite
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleListCmd *cobra.Command
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleListCmd *cobra.Command
}

func (s *ScheduleCreateCmdTestSuite) SetupTest() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/schedule/remove/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package remove
import (
"fmt"
"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
)

func NewCmd(printer io.Printer, proctorDClient daemon.Client) *cobra.Command {
Expand Down
12 changes: 6 additions & 6 deletions cmd/schedule/remove/remove_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package remove

import (
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"proctor/daemon"
"proctor/io"
"testing"
"github.com/stretchr/testify/assert"
)

type ScheduleCreateCmdTestSuite struct {
suite.Suite
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleRemoveCmd *cobra.Command
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleRemoveCmd *cobra.Command
}

func (s *ScheduleCreateCmdTestSuite) SetupTest() {
Expand Down
17 changes: 8 additions & 9 deletions cmd/schedule/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@ package schedule
import (
"fmt"
"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"strings"
)

func NewCmd(printer io.Printer,proctorDClient daemon.Client) *cobra.Command {
func NewCmd(printer io.Printer, proctorDClient daemon.Client) *cobra.Command {
return &cobra.Command{
Use: "schedule",
Short: "Create scheduled jobs",
Long: "This command helps to create scheduled jobs",
Example: fmt.Sprintf("proctor schedule run-sample -g my-group -t '0 2 * * *' -n 'username@mail.com' -T 'sample,proctor' ARG_ONE1=foobar"),
Args: cobra.MinimumNArgs(1),
Example: fmt.Sprintf("proctor schedule run-sample -g my-group -t '0 2 * * *' -n 'username@mail.com' -T 'sample,proctor' ARG_ONE1=foobar"),
Args: cobra.MinimumNArgs(1),

Run: func(cmd *cobra.Command, args []string) {
procName := args[0]
printer.Println(fmt.Sprintf("%-40s %-100s", "Creating Scheduled Job", procName), color.Reset)
time, err := cmd.Flags().GetString("time")
if err != nil {
printer.Println(err.Error(),color.FgRed)
printer.Println(err.Error(), color.FgRed)
}

notificationEmails, err := cmd.Flags().GetString("notify")
if err != nil {
printer.Println(err.Error(),color.FgRed)
printer.Println(err.Error(), color.FgRed)
}

tags, err := cmd.Flags().GetString("tags")
if err != nil {
printer.Println(err.Error(),color.FgRed)
printer.Println(err.Error(), color.FgRed)
}

group, err := cmd.Flags().GetString("group")
if err != nil {
printer.Println(err.Error(),color.FgRed)
printer.Println(err.Error(), color.FgRed)
}

jobArgs := make(map[string]string)
Expand Down Expand Up @@ -70,4 +70,3 @@ func NewCmd(printer io.Printer,proctorDClient daemon.Client) *cobra.Command {
},
}
}

12 changes: 6 additions & 6 deletions cmd/schedule/schedule_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package schedule

import (
"proctor/daemon"
"proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"proctor/daemon"
"proctor/io"
"testing"
"github.com/stretchr/testify/assert"
)

type ScheduleCreateCmdTestSuite struct {
suite.Suite
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleCreateCmd *cobra.Command
mockPrinter *io.MockPrinter
mockProctorDClient *daemon.MockClient
testScheduleCreateCmd *cobra.Command
}

func (s *ScheduleCreateCmdTestSuite) SetupTest() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"

"github.com/fatih/color"
"github.com/spf13/cobra"
"proctor/cmd/version/github"
"proctor/io"
"github.com/spf13/cobra"
)

const ClientVersion = "v0.6.0"
Expand Down
4 changes: 2 additions & 2 deletions cmd/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"testing"

"github.com/fatih/color"
gh "proctor/cmd/version/github"
"proctor/io"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
gh "proctor/cmd/version/github"
"proctor/io"
)

func TestVersionCmdUsage(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"time"

"proctor/proctord/utility"
"github.com/pkg/errors"
"proctor/proctord/utility"

"github.com/spf13/viper"
)
Expand Down
Loading

0 comments on commit a0cc632

Please sign in to comment.