Skip to content

Commit

Permalink
comment on use of init() for plugin handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmood Ali committed Jun 19, 2019
1 parent eeaa95d commit 8fb9d25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/logmon/z_logmon_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
"github.com/hashicorp/nomad/plugins/base"
)

// Install a plugin cli handler to ease working with tests
// and external plugins.
// This init() must be initialized last in package required by the child plugin
// process. It's recommended to avoid any other `init()` or inline any necessary calls
// here. See eeaa95d commit message for more details.
func init() {
if len(os.Args) > 1 && os.Args[1] == "logmon" {
logger := hclog.New(&hclog.LoggerOptions{
Expand Down
5 changes: 5 additions & 0 deletions drivers/docker/docklog/z_docker_logger_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
"github.com/hashicorp/nomad/plugins/base"
)

// Install a plugin cli handler to ease working with tests
// and external plugins.
// This init() must be initialized last in package required by the child plugin
// process. It's recommended to avoid any other `init()` or inline any necessary calls
// here. See eeaa95d commit message for more details.
func init() {
if len(os.Args) > 1 && os.Args[1] == PluginName {
logger := log.New(&log.LoggerOptions{
Expand Down
5 changes: 5 additions & 0 deletions drivers/shared/executor/z_executor_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import (
"github.com/hashicorp/nomad/plugins/base"
)

// Install a plugin cli handler to ease working with tests
// and external plugins.
// This init() must be initialized last in package required by the child plugin
// process. It's recommended to avoid any other `init()` or inline any necessary calls
// here. See eeaa95d commit message for more details.
func init() {
if len(os.Args) > 1 && os.Args[1] == "executor" {
if len(os.Args) != 3 {
Expand Down

0 comments on commit 8fb9d25

Please sign in to comment.