Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed May 29, 2017
1 parent fa7deb1 commit d971a37
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/go-modules/modules/tags"
)

// newBinding returns a new binding configured with binder
// newBinding returns a new binding configured with b
func newBinding(binder *Binder) *binding {
return &binding{
binder,
Expand Down
2 changes: 1 addition & 1 deletion inject/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestInjector(t *testing.T) {
os.Clearenv()
for k, v := range testCase.envVars {
if err := os.Setenv(k, v); err != nil {
t.Errorf("failed to set environment variable", err)
t.Errorf("failed to set environment variable: %s", err)
}
}
if ok, err := Inject(testCase.value, testCase.tagValue); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion inject/file/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ func TestInjector(t *testing.T) {
} else if bytes, err := ioutil.ReadAll(&f); err != nil {
t.Error(err)
} else if string(bytes) != "test" {
t.Errorf(`%s: expected "test" but got %q`, string(bytes))
t.Errorf(`file: expected "test" but got %q`, string(bytes))
}
}
10 changes: 5 additions & 5 deletions inject/flag/flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func TestInjector(t *testing.T) {
reflect.ValueOf(1234),
},
} {
flags := flag.NewFlagSet("test set", flag.ContinueOnError)
flags.String(testCase.tagValue, "", "")
if err := flags.Parse(testCase.args); err != nil {
t.Fatalf("failed to set command line flags: ", err)
fs := flag.NewFlagSet("test set", flag.ContinueOnError)
fs.String(testCase.tagValue, "", "")
if err := fs.Parse(testCase.args); err != nil {
t.Fatalf("failed to set command line fs: %s", err)
}

if ok, err := (&injector{flags}).Inject(testCase.value, testCase.tagValue); err != nil {
if ok, err := (&injector{fs}).Inject(testCase.value, testCase.tagValue); err != nil {
t.Error(err)
} else if !ok {
t.Error("expected value to be set")
Expand Down
2 changes: 1 addition & 1 deletion inject/typed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestInject(t *testing.T) {
}
for _, testCase := range testCases {
if b, err := constantInjector.Inject(testCase.value, ""); err != nil {
t.Errorf("unexpected error: ", err)
t.Errorf("unexpected error: %s", err)
} else if !b {
t.Error("expected value to be set")
} else if !reflect.DeepEqual(testCase.expected.Interface(), testCase.value.Interface()) {
Expand Down
4 changes: 2 additions & 2 deletions modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func (v Injectors) configure(b *Binder) {

// Bind binds modules. Calls Provide() on modules implementing Provider, calls
// inject.Injectors for tagged fields, and injects provided fields.
func (binder *Binder) Bind(modules ...interface{}) error {
binding := newBinding(binder)
func (b *Binder) Bind(modules ...interface{}) error {
binding := newBinding(b)
// Holds errors during binding.
errs := make([]error, 0)

Expand Down
12 changes: 6 additions & 6 deletions tags/tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func TestForEach(t *testing.T) {
} {
handled = false
if err := testTag.ForEach(handler); err != nil {
t.Errorf("failed to handle tag", err)
t.Errorf("failed to handle tag: %s", err)
} else if !handled {
t.Errorf("expected tag to be handled")
t.Error("expected tag to be handled")
}
}

Expand All @@ -33,9 +33,9 @@ func TestForEach(t *testing.T) {
} {
handled = false
if err := testTag.ForEach(handler); err != nil {
t.Errorf("failed to handle tag", err)
t.Errorf("failed to handle tag: %s", err)
} else if handled {
t.Errorf("expected tag to be skipped")
t.Error("expected tag to be skipped")
}
}
}
Expand All @@ -47,9 +47,9 @@ func TestGet(t *testing.T) {
`key2:"value2" key1:"value1" key3:"value3"`,
} {
if value, ok := testCase.Get("key1"); !ok {
t.Errorf("expected to find key1")
t.Error("expected to find key1")
} else if value != "value1" {
t.Errorf("expected value1 got %q", value)
t.Errorf(`expected "value1" got %q`, value)
}
}
}

0 comments on commit d971a37

Please sign in to comment.