Skip to content

Commit

Permalink
Run go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
stein committed Jul 11, 2018
1 parent 091f6bc commit fafebae
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 28 deletions.
12 changes: 6 additions & 6 deletions cloner/cloner_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package cloner

import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/steinfletcher/github-org-clone/github"
"github.com/stretchr/testify/assert"
"testing"
)

func TestGetTeamId(t *testing.T) {
teams := []github.Team{
{Name:"team1", Id:1},
{Name:"team2", Id:51},
{Name:"team3", Id:101},
{Name: "team1", Id: 1},
{Name: "team2", Id: 51},
{Name: "team3", Id: 101},
}

_, id := teamId(teams, "team3")
Expand All @@ -20,7 +20,7 @@ func TestGetTeamId(t *testing.T) {

func TestGetTeamIdErrorsIfNotFound(t *testing.T) {
teams := []github.Team{
{Name:"team1", Id:1},
{Name: "team1", Id: 1},
}

err, _ := teamId(teams, "team3")
Expand Down
8 changes: 4 additions & 4 deletions github/github.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package github

import (
"net/http"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"time"
"encoding/json"
"net/http"
"strings"
"errors"
"time"
)

func NewGithub(username string, apiToken string) Github {
Expand Down
4 changes: 2 additions & 2 deletions github/github_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package github

import (
"testing"
"github.com/stretchr/testify/assert"
"gopkg.in/h2non/gock.v1"
"testing"
)

func TestFetchTeams(t *testing.T) {
Expand Down Expand Up @@ -52,4 +52,4 @@ func teamReposResp(page string, linkHeader string, file string) {
Reply(200).
SetHeader("Link", linkHeader).
File("../testdata/" + file)
}
}
26 changes: 13 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package main

import (
"os"
"github.com/urfave/cli"
"fmt"
"github.com/steinfletcher/github-org-clone/cloner"
"github.com/steinfletcher/github-org-clone/github"
"github.com/steinfletcher/github-org-clone/shell"
"github.com/steinfletcher/github-org-clone/cloner"
"github.com/urfave/cli"
"log"
"fmt"
"os"
"time"
)

Expand All @@ -28,30 +28,30 @@ func main() {
app.Description = "A simple cli to clone all the repos managed by a github team"
app.Metadata = map[string]interface{}{
"commit": commit,
"date": date,
"date": date,
}

app.Flags = []cli.Flag {
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "org, o",
Name: "org, o",
Usage: "github organisation",
},
cli.StringFlag{
Name: "team, t",
Name: "team, t",
Usage: "github team",
},
cli.StringFlag{
Name: "username, u",
Usage: "github username",
Name: "username, u",
Usage: "github username",
EnvVar: "GITHUB_USER,GITHUB_USERNAME",
},
cli.StringFlag{
Name: "token, k",
Usage: "github personal access token",
Name: "token, k",
Usage: "github personal access token",
EnvVar: "GITHUB_TOKEN,GITHUB_API_KEY,GITHUB_PERSONAL_ACCESS_TOKEN",
},
cli.StringFlag{
Name: "dir, d",
Name: "dir, d",
Usage: "directory to clone into. Defaults to the org name or org/team name if defined",
},
}
Expand Down
2 changes: 2 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ build:

install:
go install

all: test build install
6 changes: 3 additions & 3 deletions shell/shell.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package shell

import (
"os/exec"
"fmt"
"os/exec"
)

type Shell interface {
Exec(cmd string, args []string) error
}

type shell struct {}
type shell struct{}

func NewShell() Shell {
return &shell{}
Expand All @@ -24,4 +24,4 @@ func (s *shell) Exec(cmd string, args []string) error {
fmt.Printf("%s", out)
}
return nil
}
}

0 comments on commit fafebae

Please sign in to comment.