mirror of https://github.com/dirtbags/moth.git
Linter and spelling fixes
This commit is contained in:
parent
63f84d1f20
commit
14b92fe617
|
@ -106,7 +106,7 @@ func (pc ProviderCommand) CheckAnswer(cat string, points int, answer string) (bo
|
|||
|
||||
stdout, err := cmd.Output()
|
||||
if ee, ok := err.(*exec.ExitError); ok {
|
||||
log.Printf("%s: %s", pc.Path, string(ee.Stderr))
|
||||
log.Printf("WARNING: %s: %s", pc.Path, string(ee.Stderr))
|
||||
return false, err
|
||||
} else if err != nil {
|
||||
return false, err
|
||||
|
@ -114,9 +114,7 @@ func (pc ProviderCommand) CheckAnswer(cat string, points int, answer string) (bo
|
|||
result := strings.TrimSpace(string(stdout))
|
||||
|
||||
if result != "correct" {
|
||||
if result == "" {
|
||||
result = "Nothing written to stdout"
|
||||
}
|
||||
log.Printf("WARNING: %s: Nothing written to stdout", pc.Path)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ func TestStateDisabled(t *testing.T) {
|
|||
s.Remove("initialized")
|
||||
s.refresh()
|
||||
if !s.Enabled {
|
||||
t.Error("Re-initalizing didn't start event")
|
||||
t.Error("Re-initializing didn't start event")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,29 +79,28 @@ func (a T) UnmarshalJSON(b []byte) error {
|
|||
dec.UseNumber() // Don't use floats
|
||||
|
||||
// All this to make sure we get `[`
|
||||
if t, err := dec.Token(); err != nil {
|
||||
t, err := dec.Token()
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
switch token := t.(type) {
|
||||
case json.Delim:
|
||||
if token.String() != "[" {
|
||||
return &json.UnmarshalTypeError{
|
||||
Value: token.String(),
|
||||
Type: reflect.TypeOf(a),
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
default:
|
||||
}
|
||||
switch token := t.(type) {
|
||||
case json.Delim:
|
||||
if token.String() != "[" {
|
||||
return &json.UnmarshalTypeError{
|
||||
Value: fmt.Sprintf("%v", t),
|
||||
Value: token.String(),
|
||||
Type: reflect.TypeOf(a),
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
default:
|
||||
return &json.UnmarshalTypeError{
|
||||
Value: fmt.Sprintf("%v", t),
|
||||
Type: reflect.TypeOf(a),
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
|
||||
var num json.Number
|
||||
var err error
|
||||
if err := dec.Decode(&num); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -122,25 +121,25 @@ func (a T) UnmarshalJSON(b []byte) error {
|
|||
}
|
||||
|
||||
// All this to make sure we get `]`
|
||||
if t, err := dec.Token(); err != nil {
|
||||
t, err = dec.Token()
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
switch token := t.(type) {
|
||||
case json.Delim:
|
||||
if token.String() != "]" {
|
||||
return &json.UnmarshalTypeError{
|
||||
Value: token.String(),
|
||||
Type: reflect.TypeOf(a),
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
default:
|
||||
}
|
||||
switch token := t.(type) {
|
||||
case json.Delim:
|
||||
if token.String() != "]" {
|
||||
return &json.UnmarshalTypeError{
|
||||
Value: fmt.Sprintf("%v", t),
|
||||
Value: token.String(),
|
||||
Type: reflect.TypeOf(a),
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
default:
|
||||
return &json.UnmarshalTypeError{
|
||||
Value: fmt.Sprintf("%v", t),
|
||||
Type: reflect.TypeOf(a),
|
||||
Offset: 0,
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue