Skip to content

Commit

Permalink
all: reformat with goimports
Browse files Browse the repository at this point in the history
  • Loading branch information
msfjarvis committed Jun 1, 2022
1 parent 5cb209a commit 77f570f
Show file tree
Hide file tree
Showing 22 changed files with 55 additions and 35 deletions.
4 changes: 2 additions & 2 deletions auth/file_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package auth

import (
"encoding/json"
"golang.org/x/oauth2"
"io/ioutil"
"os"

"golang.org/x/oauth2"
)

func FileSource(path string, token *oauth2.Token, conf *oauth2.Config) oauth2.TokenSource {
Expand Down Expand Up @@ -43,7 +44,6 @@ func ReadFile(path string) ([]byte, bool, error) {
return content, true, nil
}


func ReadToken(path string) (*oauth2.Token, bool, error) {

content, exists, err := ReadFile(path)
Expand Down
11 changes: 6 additions & 5 deletions auth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package auth

import (
"fmt"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"net/http"
"time"

"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
)

type authCodeFn func(string) func() string
Expand Down Expand Up @@ -67,16 +68,16 @@ func NewAccessTokenClient(clientId, clientSecret, accessToken string) *http.Clie

func NewServiceAccountClient(serviceAccountFile string) (*http.Client, error) {
content, exists, err := ReadFile(serviceAccountFile)
if(!exists) {
if !exists {
return nil, fmt.Errorf("Service account filename %q not found", serviceAccountFile)
}

if(err != nil) {
if err != nil {
return nil, err
}

conf, err := google.JWTConfigFromJSON(content, "https://www.googleapis.com/auth/drive")
if(err != nil) {
if err != nil {
return nil, err
}
return conf.Client(oauth2.NoContext), nil
Expand Down
3 changes: 2 additions & 1 deletion compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package main

import (
"encoding/json"
"github.com/msfjarvis/gdrive/drive"
"os"

"github.com/msfjarvis/gdrive/drive"
)

const MinCacheFileSize = 5 * 1024 * 1024
Expand Down
3 changes: 2 additions & 1 deletion drive/changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"io"
"text/tabwriter"

"google.golang.org/api/drive/v3"
)

type ListChangesArgs struct {
Expand Down
3 changes: 2 additions & 1 deletion drive/drive.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package drive

import (
"google.golang.org/api/drive/v3"
"net/http"

"google.golang.org/api/drive/v3"
)

type Drive struct {
Expand Down
3 changes: 2 additions & 1 deletion drive/errors.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package drive

import (
"time"

"golang.org/x/net/context"
"google.golang.org/api/googleapi"
"time"
)

const MaxErrorRetries = 5
Expand Down
3 changes: 2 additions & 1 deletion drive/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"io"

"google.golang.org/api/drive/v3"
)

type FileInfoArgs struct {
Expand Down
5 changes: 3 additions & 2 deletions drive/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package drive

import (
"fmt"
"io"
"text/tabwriter"

"golang.org/x/net/context"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"text/tabwriter"
)

type ListFilesArgs struct {
Expand Down
3 changes: 2 additions & 1 deletion drive/mkdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"io"

"google.golang.org/api/drive/v3"
)

const DirectoryMimeType = "application/vnd.google-apps.folder"
Expand Down
3 changes: 2 additions & 1 deletion drive/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"path/filepath"

"google.golang.org/api/drive/v3"
)

func (self *Drive) newPathfinder() *remotePathfinder {
Expand Down
3 changes: 2 additions & 1 deletion drive/revision_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"io"
"text/tabwriter"

"google.golang.org/api/drive/v3"
)

type ListRevisionsArgs struct {
Expand Down
3 changes: 2 additions & 1 deletion drive/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"io"
"text/tabwriter"

"google.golang.org/api/drive/v3"
)

type ShareArgs struct {
Expand Down
9 changes: 5 additions & 4 deletions drive/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package drive

import (
"fmt"
"github.com/sabhiram/go-gitignore"
"github.com/soniakeys/graph"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"os"
"path/filepath"
"strings"
"text/tabwriter"
"time"

ignore "github.com/sabhiram/go-gitignore"
"github.com/soniakeys/graph"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
)

const DefaultIgnoreFile = ".gdriveignore"
Expand Down
5 changes: 3 additions & 2 deletions drive/sync_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package drive
import (
"bytes"
"fmt"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"os"
"path/filepath"
"sort"
"time"

"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
)

type DownloadSyncArgs struct {
Expand Down
5 changes: 3 additions & 2 deletions drive/sync_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"sort"
"text/tabwriter"

"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
)

type ListSyncArgs struct {
Expand Down
5 changes: 3 additions & 2 deletions drive/sync_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package drive
import (
"bytes"
"fmt"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"os"
"path/filepath"
"sort"
"time"

"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
)

type UploadSyncArgs struct {
Expand Down
3 changes: 2 additions & 1 deletion drive/timeout_reader.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package drive

import (
"golang.org/x/net/context"
"io"
"sync"
"time"

"golang.org/x/net/context"
)

const TimeoutTimerInterval = time.Second * 10
Expand Down
5 changes: 3 additions & 2 deletions drive/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"mime"
"path/filepath"
"time"

"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
)

type UpdateArgs struct {
Expand Down
5 changes: 3 additions & 2 deletions drive/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package drive

import (
"fmt"
"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
"io"
"mime"
"os"
"path/filepath"
"time"

"google.golang.org/api/drive/v3"
"google.golang.org/api/googleapi"
)

type UploadArgs struct {
Expand Down
2 changes: 1 addition & 1 deletion drive/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func formatSize(bytes int64, forceBytes bool) string {
if bytes == 0 {
return ""
} else if bytes < 0 {
return "Unlimited"
return "Unlimited"
}

if forceBytes {
Expand Down
1 change: 1 addition & 0 deletions handlers_drive.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

var ClientId string
var ClientSecret string

const TokenFilename = "token_v2.json"
const DefaultCacheFileName = "file_cache.json"

Expand Down
3 changes: 2 additions & 1 deletion handlers_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package main

import (
"fmt"
"github.com/msfjarvis/gdrive/cli"
"os"
"runtime"
"strings"
"text/tabwriter"

"github.com/msfjarvis/gdrive/cli"
)

func printVersion(ctx cli.Context) {
Expand Down

0 comments on commit 77f570f

Please sign in to comment.