diff --git a/commands/command_clean.go b/commands/command_clean.go index bb0a9e11..fc176e75 100644 --- a/commands/command_clean.go +++ b/commands/command_clean.go @@ -1,9 +1,10 @@ package commands import ( + "os" + "github.com/github/git-lfs/lfs" "github.com/spf13/cobra" - "os" ) var ( diff --git a/commands/command_logs.go b/commands/command_logs.go index 9d32b1da..46209d41 100644 --- a/commands/command_logs.go +++ b/commands/command_logs.go @@ -2,11 +2,12 @@ package commands import ( "errors" - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io/ioutil" "os" "path/filepath" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/command_pointer.go b/commands/command_pointer.go index a3eb87ad..6211e44c 100644 --- a/commands/command_pointer.go +++ b/commands/command_pointer.go @@ -6,11 +6,12 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io" "os" "os/exec" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/command_push.go b/commands/command_push.go index d2818ea2..c19c1323 100644 --- a/commands/command_push.go +++ b/commands/command_push.go @@ -1,13 +1,14 @@ package commands import ( + "io/ioutil" + "os" + "strings" + "github.com/github/git-lfs/git" "github.com/github/git-lfs/lfs" "github.com/rubyist/tracerx" "github.com/spf13/cobra" - "io/ioutil" - "os" - "strings" ) var ( diff --git a/commands/command_smudge.go b/commands/command_smudge.go index 5f56a233..bcd82ca1 100644 --- a/commands/command_smudge.go +++ b/commands/command_smudge.go @@ -2,11 +2,12 @@ package commands import ( "bytes" - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io" "os" "path/filepath" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/command_status.go b/commands/command_status.go index b125ef8a..4f4ea066 100644 --- a/commands/command_status.go +++ b/commands/command_status.go @@ -2,6 +2,7 @@ package commands import ( "fmt" + "github.com/github/git-lfs/git" "github.com/github/git-lfs/lfs" "github.com/spf13/cobra" diff --git a/commands/command_track.go b/commands/command_track.go index 6797cf26..9e601371 100644 --- a/commands/command_track.go +++ b/commands/command_track.go @@ -3,12 +3,13 @@ package commands import ( "bufio" "fmt" - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io" "os" "path/filepath" "strings" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/command_untrack.go b/commands/command_untrack.go index 15081bac..f2ebc480 100644 --- a/commands/command_untrack.go +++ b/commands/command_untrack.go @@ -2,11 +2,12 @@ package commands import ( "bufio" - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io/ioutil" "os" "strings" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/commands.go b/commands/commands.go index bb1dd643..cb378497 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -3,8 +3,6 @@ package commands import ( "bytes" "fmt" - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io" "log" "os" @@ -12,6 +10,9 @@ import ( "path/filepath" "strings" "time" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/commands_pre_push.go b/commands/commands_pre_push.go index 754abe34..d751b542 100644 --- a/commands/commands_pre_push.go +++ b/commands/commands_pre_push.go @@ -1,11 +1,12 @@ package commands import ( - "github.com/github/git-lfs/lfs" - "github.com/spf13/cobra" "io/ioutil" "os" "strings" + + "github.com/github/git-lfs/lfs" + "github.com/spf13/cobra" ) var ( diff --git a/commands/commands_test.go b/commands/commands_test.go index 8dd322ac..f5a2c7f4 100644 --- a/commands/commands_test.go +++ b/commands/commands_test.go @@ -3,7 +3,6 @@ package commands import ( "errors" "fmt" - "github.com/bmizerany/assert" "io" "io/ioutil" "os" @@ -11,6 +10,8 @@ import ( "path/filepath" "strings" "testing" + + "github.com/bmizerany/assert" ) var ( diff --git a/commands/init_test.go b/commands/init_test.go index 67387f6e..17e2e670 100644 --- a/commands/init_test.go +++ b/commands/init_test.go @@ -1,12 +1,13 @@ package commands import ( - "github.com/bmizerany/assert" "io/ioutil" "os" "path/filepath" "strings" "testing" + + "github.com/bmizerany/assert" ) func TestInit(t *testing.T) { diff --git a/commands/pointer_test.go b/commands/pointer_test.go index 04af5814..684c9842 100644 --- a/commands/pointer_test.go +++ b/commands/pointer_test.go @@ -1,12 +1,13 @@ package commands import ( - "github.com/bmizerany/assert" "io/ioutil" "os" "path/filepath" "strings" "testing" + + "github.com/bmizerany/assert" ) func TestPointerWithBuildAndCompareStdinMismatch(t *testing.T) { diff --git a/commands/smudge_test.go b/commands/smudge_test.go index e504bca0..f73b1525 100644 --- a/commands/smudge_test.go +++ b/commands/smudge_test.go @@ -2,11 +2,12 @@ package commands import ( "bytes" - "github.com/bmizerany/assert" "io/ioutil" "os" "path/filepath" "testing" + + "github.com/bmizerany/assert" ) func TestSmudge(t *testing.T) { diff --git a/commands/track_test.go b/commands/track_test.go index 24d114d4..017e5370 100644 --- a/commands/track_test.go +++ b/commands/track_test.go @@ -1,11 +1,12 @@ package commands import ( - "github.com/bmizerany/assert" "io/ioutil" "os" "path/filepath" "testing" + + "github.com/bmizerany/assert" ) func TestTrack(t *testing.T) { diff --git a/commands/version_test.go b/commands/version_test.go index fa366f46..47b54ccc 100644 --- a/commands/version_test.go +++ b/commands/version_test.go @@ -2,8 +2,9 @@ package commands import ( "fmt" - "github.com/github/git-lfs/lfs" "testing" + + "github.com/github/git-lfs/lfs" ) func TestVersionOnEmptyRepository(t *testing.T) { diff --git a/git/git.go b/git/git.go index 2334588c..e43e8748 100644 --- a/git/git.go +++ b/git/git.go @@ -4,10 +4,11 @@ package git import ( "errors" "fmt" - "github.com/rubyist/tracerx" "io" "os/exec" "strings" + + "github.com/rubyist/tracerx" ) func LsRemote(remote, remoteRef string) (string, error) { diff --git a/lfs/client.go b/lfs/client.go index a35a1cea..2cbc830f 100644 --- a/lfs/client.go +++ b/lfs/client.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/rubyist/tracerx" "io" "io/ioutil" "net/http" @@ -14,6 +13,8 @@ import ( "path/filepath" "regexp" "strconv" + + "github.com/rubyist/tracerx" ) const ( diff --git a/lfs/config.go b/lfs/config.go index 1c3cab9a..ab6f9c41 100644 --- a/lfs/config.go +++ b/lfs/config.go @@ -2,7 +2,6 @@ package lfs import ( "fmt" - "github.com/github/git-lfs/git" "net/http" "net/url" "os" @@ -11,6 +10,8 @@ import ( "strconv" "strings" "sync" + + "github.com/github/git-lfs/git" ) type Configuration struct { diff --git a/lfs/config_test.go b/lfs/config_test.go index 7ebc046a..cb14e6fa 100644 --- a/lfs/config_test.go +++ b/lfs/config_test.go @@ -1,8 +1,9 @@ package lfs import ( - "github.com/bmizerany/assert" "testing" + + "github.com/bmizerany/assert" ) func TestEndpointDefaultsToOrigin(t *testing.T) { diff --git a/lfs/http.go b/lfs/http.go index 87d84e00..3f8ccad9 100644 --- a/lfs/http.go +++ b/lfs/http.go @@ -4,13 +4,14 @@ import ( "crypto/tls" "errors" "fmt" - "github.com/rubyist/tracerx" "io" "net" "net/http" "os" "strings" "time" + + "github.com/rubyist/tracerx" ) func DoHTTP(c *Configuration, req *http.Request) (*http.Response, error) { diff --git a/lfs/lfs.go b/lfs/lfs.go index 0926725c..f01cb4a5 100644 --- a/lfs/lfs.go +++ b/lfs/lfs.go @@ -2,13 +2,14 @@ package lfs import ( "fmt" - "github.com/github/git-lfs/git" - "github.com/rubyist/tracerx" "io/ioutil" "os" "path/filepath" "runtime" "strings" + + "github.com/github/git-lfs/git" + "github.com/rubyist/tracerx" ) const Version = "0.5.1" diff --git a/lfs/pointer_smudge.go b/lfs/pointer_smudge.go index 952d0221..425454e6 100644 --- a/lfs/pointer_smudge.go +++ b/lfs/pointer_smudge.go @@ -2,12 +2,12 @@ package lfs import ( "fmt" - "github.com/cheggaaa/pb" - "github.com/rubyist/tracerx" - "github.com/technoweenie/go-contentaddressable" "io" "os" "path/filepath" + + "github.com/cheggaaa/pb" + "github.com/rubyist/tracerx" ) func PointerSmudge(writer io.Writer, ptr *Pointer, workingfile string, cb CopyCallback) error { diff --git a/lfs/pointer_test.go b/lfs/pointer_test.go index 49ec6703..47aa6d77 100644 --- a/lfs/pointer_test.go +++ b/lfs/pointer_test.go @@ -3,9 +3,10 @@ package lfs import ( "bufio" "bytes" - "github.com/bmizerany/assert" "strings" "testing" + + "github.com/bmizerany/assert" ) func TestEncode(t *testing.T) { diff --git a/lfs/scanner.go b/lfs/scanner.go index 39c4affb..b93639d1 100644 --- a/lfs/scanner.go +++ b/lfs/scanner.go @@ -3,13 +3,14 @@ package lfs import ( "bufio" "bytes" - "github.com/rubyist/tracerx" "io" "os/exec" "regexp" "strconv" "strings" "time" + + "github.com/rubyist/tracerx" ) const ( diff --git a/lfs/setup.go b/lfs/setup.go index 3448eceb..1e4d7b2a 100644 --- a/lfs/setup.go +++ b/lfs/setup.go @@ -3,13 +3,14 @@ package lfs import ( "errors" "fmt" - "github.com/github/git-lfs/git" "io" "io/ioutil" "os" "path/filepath" "regexp" "strings" + + "github.com/github/git-lfs/git" ) var ( diff --git a/lfs/ssh.go b/lfs/ssh.go index 0ecb7b82..c8c8d88b 100644 --- a/lfs/ssh.go +++ b/lfs/ssh.go @@ -2,8 +2,9 @@ package lfs import ( "encoding/json" - "github.com/rubyist/tracerx" "os/exec" + + "github.com/rubyist/tracerx" ) type sshAuthResponse struct { diff --git a/lfs/upload_queue.go b/lfs/upload_queue.go index 145fd1fe..0442a895 100644 --- a/lfs/upload_queue.go +++ b/lfs/upload_queue.go @@ -2,11 +2,12 @@ package lfs import ( "fmt" - "github.com/cheggaaa/pb" "os" "path/filepath" "sync" "sync/atomic" + + "github.com/cheggaaa/pb" ) var ( diff --git a/lfs/util_test.go b/lfs/util_test.go index 94b4c07e..6a2d84cf 100644 --- a/lfs/util_test.go +++ b/lfs/util_test.go @@ -2,9 +2,10 @@ package lfs import ( "bytes" - "github.com/bmizerany/assert" "io/ioutil" "testing" + + "github.com/bmizerany/assert" ) func TestWriterWithCallback(t *testing.T) { diff --git a/script/build.go b/script/build.go index d719109d..eec45732 100644 --- a/script/build.go +++ b/script/build.go @@ -4,12 +4,13 @@ import ( "encoding/json" "flag" "fmt" - "github.com/github/git-lfs/lfs" "log" "os" "os/exec" "path/filepath" "strings" + + "github.com/github/git-lfs/lfs" ) var ( diff --git a/script/fmt b/script/fmt index 6bc3856b..d073d4d0 100755 --- a/script/fmt +++ b/script/fmt @@ -1,10 +1,16 @@ #!/bin/bash +hash goimports 2>/dev/null || { + echo "Installing goimports" + echo "go get golang.org/x/tools/cmd/goimports" + go get golang.org/x/tools/cmd/goimports +} + # don't run gofmt in these directories ignored=(/bin/ /docs/ /log/ /man/ /tmp/ .vendor) for i in */ ; do if [[ ! ${ignored[*]} =~ "/$i" ]]; then - gofmt -w -l "$@" "${i%?}" + goimports -w -l "$@" "${i%?}" fi done