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,9 +79,10 @@ 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() != "[" {
|
||||
|
@ -98,10 +99,8 @@ func (a T) UnmarshalJSON(b []byte) error {
|
|||
Offset: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var num json.Number
|
||||
var err error
|
||||
if err := dec.Decode(&num); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -122,9 +121,10 @@ 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() != "]" {
|
||||
|
@ -141,7 +141,6 @@ func (a T) UnmarshalJSON(b []byte) error {
|
|||
Offset: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue