Skip to content

Commit

Permalink
chore(fmt): run gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
b5 authored and dustmop committed Jul 15, 2019
1 parent c4846d0 commit 3a0a50e
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 48 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"net/rpc"
"time"

"github.com/qri-io/apiutil"
golog "github.com/ipfs/go-log"
"github.com/qri-io/apiutil"
"github.com/qri-io/dag"
"github.com/qri-io/dag/dsync"
"github.com/qri-io/qfs/cafs"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"testing"
"time"

golog "github.com/ipfs/go-log"
"github.com/qri-io/dataset/dsfs"
"github.com/qri-io/ioes"
ipfs_filestore "github.com/qri-io/qfs/cafs/ipfs"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/qri-io/qri/repo/gen"
regmock "github.com/qri-io/registry/regserver/mock"
"github.com/spf13/cobra"
golog "github.com/ipfs/go-log"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/qri-io/dataset"
"github.com/qri-io/ioes"
"github.com/qri-io/qri/lib"
"github.com/qri-io/qri/fsi"
"github.com/qri-io/qri/lib"
"github.com/qri-io/varName"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/json"
"fmt"

util "github.com/qri-io/apiutil"
"github.com/ghodss/yaml"
util "github.com/qri-io/apiutil"
"github.com/qri-io/ioes"
"github.com/qri-io/qri/config"
"github.com/qri-io/qri/lib"
Expand Down
2 changes: 1 addition & 1 deletion cmd/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type SaveOptions struct {
// Complete adds any missing configuration that can only be added just before calling Run
func (o *SaveOptions) Complete(f Factory, args []string) (err error) {
o.Ref, err = GetDatasetRefString(f, args, 0)

wd, err := os.Getwd()
if err != nil {
return err
Expand Down
4 changes: 3 additions & 1 deletion cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ func (o *StatusOptions) Run() (err error) {
}

for _, si := range res {
printErr(o.ErrOut, fmt.Errorf("%s: %s (source: %s)", si.Type, si.Path, filepath.Base(si.SourceFile)))
if si.Type != "unmodified" {
printErr(o.ErrOut, fmt.Errorf("%s: %s (source: %s)", si.Type, si.Path, filepath.Base(si.SourceFile)))
}
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/stringers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func TestJobStringer(t *testing.T) {
cases := []struct {
description string
job *lib.Job
contains string
contains string
}{
{"JobStringer - all fields",
&lib.Job{
Expand Down
2 changes: 1 addition & 1 deletion cmd/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestUpdateMethods(t *testing.T) {
if err := o.List(); err != nil {
t.Error(err)
}

// TODO (b5) - wee note on TestJobStringer, we should be testing times by setting local timezones
listStdOutContains := "| shell"
if !strings.Contains(out.String(), listStdOutContains) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func GetDatasetRefString(f Factory, args []string, index int) (string, error) {
if index < len(args) {
return args[index], nil
}

wd, err := os.Getwd()
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion fsi/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func ReadDir(dir string) (ds *dataset.Dataset, mapping map[string]string, err er
case componentNameTransform:
ds.Transform = cmp.(*dataset.Transform)
case componentNameBody:
ds.BodyPath = path
ds.BodyPath = path
// ds.Body = cmp.(*dataset.Body)
// // TODO (b5) -
}
Expand Down
37 changes: 21 additions & 16 deletions fsi/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@ package fsi

import (
"bytes"
"fmt"
"encoding/json"
"fmt"

"github.com/qri-io/qri/repo"
"github.com/qri-io/dataset"
"github.com/qri-io/dataset/dsfs"
"github.com/qri-io/qri/repo"
// "github.com/qri-io/dataset/validate"
)


type StatusType string

var (
STAdd StatusType = "add"
STChange StatusType = "modified"
STRemove StatusType = "remove"
STUnmodified = "unmodified"
STAdd = "add"
STChange = "modified"
STRemove = "remove"
)

type StatusItem struct {
SourceFile string
Path string
Type StatusType
Message string
Path string
Type string
Message string
}

// Status reads the diff status from the current working directory
Expand Down Expand Up @@ -54,11 +52,11 @@ func (fsi *FSI) Status(dir string) (changes []StatusItem, err error) {
// }

for path, sourceFilepath := range mapping {
if cmp := getComponent(stored, path);cmp == nil {
if cmp := getComponent(stored, path); cmp == nil {
change := StatusItem{
SourceFile: sourceFilepath,
Path: path,
Type: STAdd,
Path: path,
Type: STAdd,
}
changes = append(changes, change)
} else {
Expand All @@ -73,8 +71,15 @@ func (fsi *FSI) Status(dir string) (changes []StatusItem, err error) {
if !bytes.Equal(srcData, wdData) {
change := StatusItem{
SourceFile: sourceFilepath,
Path: path,
Type: STChange,
Path: path,
Type: STChange,
}
changes = append(changes, change)
} else {
change := StatusItem{
SourceFile: sourceFilepath,
Path: path,
Type: STUnmodified,
}
changes = append(changes, change)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func (r *DatasetRequests) Status(dir *string, res *[]StatusItem) (err error) {
fsint := fsi.NewFSI(r.node.Repo, "")
*res, err = fsint.Status(*dir)
return err
}
}
12 changes: 6 additions & 6 deletions lib/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ func (m *UpdateMethods) Run(p *Job, res *repo.DatasetRef) (err error) {

func absolutizeJobFilepaths(j *Job) error {
if o, ok := j.Options.(*cron.DatasetOptions); ok {
if err := qfs.AbsPath(&o.BodyPath); err != nil {
return err
}
for i := range o.FilePaths {
if err := qfs.AbsPath(&o.FilePaths[i]); err != nil {
if err := qfs.AbsPath(&o.BodyPath); err != nil {
return err
}
for i := range o.FilePaths {
if err := qfs.AbsPath(&o.FilePaths[i]); err != nil {
return err
}
}
}
}
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion lib/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestUpdateMethods(t *testing.T) {

// run the service for one second to generate updates
// sorry tests, y'all gotta run a little slower :/
ctx, done := context.WithDeadline(context.Background(), time.Now().Add(time.Second * 2))
ctx, done := context.WithDeadline(context.Background(), time.Now().Add(time.Second*2))
defer done()
if err := inst.cron.(*cron.Cron).Start(ctx); err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion startf/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"github.com/qri-io/qfs"
"github.com/qri-io/qri/p2p"
"github.com/qri-io/qri/repo"
"github.com/qri-io/starlib"
skyctx "github.com/qri-io/qri/startf/context"
skyds "github.com/qri-io/qri/startf/ds"
skyqri "github.com/qri-io/qri/startf/qri"
"github.com/qri-io/starlib"
"go.starlark.net/resolve"
"go.starlark.net/starlark"
)
Expand Down
2 changes: 1 addition & 1 deletion startf/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/qri-io/qfs"
"github.com/qri-io/qri/config"
"github.com/qri-io/qri/p2p"
"github.com/qri-io/starlib/testdata"
repoTest "github.com/qri-io/qri/repo/test"
"github.com/qri-io/starlib"
"github.com/qri-io/starlib/testdata"
"go.starlark.net/starlark"
"go.starlark.net/starlarktest"
)
Expand Down
10 changes: 5 additions & 5 deletions update/cron/cron_fbs/JobType.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions update/cron/cron_fbs/Options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion update/cron/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"net/http"
"strings"

apiutil "github.com/qri-io/apiutil"
flatbuffers "github.com/google/flatbuffers/go"
apiutil "github.com/qri-io/apiutil"
cronfb "github.com/qri-io/qri/update/cron/cron_fbs"
)

Expand Down

0 comments on commit 3a0a50e

Please sign in to comment.