Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move commands out of internal package and fix my bad formatting with … #4

Merged
merged 1 commit into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions _example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/justanotherorganization/l5424/x5424"

// Import the commands we want to be registered.
_ "github.com/justanotherorganization/graceless/internal/commands/sed"
_ "github.com/justanotherorganization/graceless/commands/sed"
)

var (
Expand Down Expand Up @@ -49,7 +49,7 @@ func init() {
}

if slackToken == "" {
logger.Log(x5424.Severity, l5424.EmergencyLvl, "Slack token must be set")
logger.Log(x5424.Severity, l5424.EmergencyLvl, "Slack token must be set\n")
os.Exit(1)
}

Expand Down Expand Up @@ -108,13 +108,12 @@ func main() {
case <-ctx.Done():
return
case <-signals:
logger.Log(x5424.Severity, l5424.InfoLvl, "Exiting...")
cancel()
return
case err := <-errCh:
if err != nil {
// For now treat all errors as non-fatal.
logger.Log(x5424.Severity, l5424.ErrorLvl, err)
logger.Log(x5424.Severity, l5424.ErrorLvl, err, "\n")
}
}
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/commands/sed/sed.go → commands/sed/sed.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os/exec"
"strings"

cmds "github.com/justanotherorganization/graceless/internal/commands"
cmds "github.com/justanotherorganization/graceless/commands"
"github.com/justanotherorganization/justanotherbotkit/commands"
"github.com/justanotherorganization/justanotherbotkit/transport"
"github.com/pkg/errors"
Expand Down
8 changes: 4 additions & 4 deletions graceless.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"strings"

cmds "github.com/justanotherorganization/graceless/commands"
"github.com/justanotherorganization/graceless/config"
"github.com/justanotherorganization/graceless/internal"
cmds "github.com/justanotherorganization/graceless/internal/commands"
"github.com/justanotherorganization/justanotherbotkit/commands"
"github.com/justanotherorganization/justanotherbotkit/proto"
"github.com/justanotherorganization/justanotherbotkit/transport"
Expand Down Expand Up @@ -41,7 +41,7 @@ func (g *Graceless) Start(ctx context.Context, cancel context.CancelFunc, errCh
startMsg += " in safemode"
}

g.config.Log(x5424.Severity, l5424.InfoLvl, startMsg)
g.config.Log(x5424.Severity, l5424.InfoLvl, startMsg, "\n")

// Start building our database (as early as possible).
if !g.Safemode() {
Expand Down Expand Up @@ -212,8 +212,8 @@ func (g *Graceless) Start(ctx context.Context, cancel context.CancelFunc, errCh
}
}

g.config.Log(x5424.Severity, l5424.InfoLvl, "Shutting down...")
g.config.Log(x5424.Severity, l5424.InfoLvl, "Goodbye")
g.config.Log(x5424.Severity, l5424.InfoLvl, "Shutting down...\n")
g.config.Log(x5424.Severity, l5424.InfoLvl, "Goodbye\n")
}

// Safemode returns whather we are currently running in safemode.
Expand Down
2 changes: 1 addition & 1 deletion internal/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

"github.com/justanotherorganization/graceless/commands"
"github.com/justanotherorganization/graceless/config"
"github.com/justanotherorganization/graceless/internal/commands"
"github.com/justanotherorganization/justanotherbotkit/transport"
"github.com/pkg/errors"
)
Expand Down