Skip to content
Snippets Groups Projects
Unverified Commit 0f64f600 authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

Linter warning fix of plugins (#393)

* :rotating_light: fix linter warnings

* :rotating_light: fix import order
parent 1bee2c81
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ import (
var enabledPlugins []string
var disabledPlugins []string
// AddPluginStatus adds the status (enabled=1, disabled=0) of a given plugin.
func AddPluginStatus(name string, status int) {
switch status {
case node.Enabled:
......
......@@ -5,9 +5,8 @@ import (
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node"
"github.com/iotaledger/hive.go/parameter"
"github.com/spf13/viper"
flag "github.com/spf13/pflag"
"github.com/spf13/viper"
)
// PluginName is the name of the config plugin.
......@@ -21,7 +20,7 @@ var (
configName = flag.StringP("config", "c", "config", "Filename of the config file without the file extension")
configDirPath = flag.StringP("config-dir", "d", ".", "Path to the directory containing the config file")
// viper
// Node is viper
Node *viper.Viper
// logger
......@@ -35,6 +34,7 @@ var (
}
)
// Init triggers the Init event.
func Init() {
Plugin.Events.Init.Trigger(Plugin)
}
......
// database is a plugin that manages the badger database (e.g. garbage collection).
// Package database is a plugin that manages the badger database (e.g. garbage collection).
package database
import (
"time"
"github.com/iotaledger/hive.go/timeutil"
"github.com/iotaledger/goshimmer/packages/database"
"github.com/iotaledger/goshimmer/packages/shutdown"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node"
"github.com/iotaledger/hive.go/timeutil"
)
// PluginName is the name of the database plugin.
......
......@@ -13,6 +13,7 @@ const PluginName = "Logger"
// Plugin is the plugin instance of the logger plugin.
var Plugin = node.NewPlugin(PluginName, node.Enabled)
// Init triggers the Init event.
func Init() {
Plugin.Events.Init.Trigger(Plugin)
}
......
package messagelayer
import (
"github.com/iotaledger/hive.go/autopeering/peer"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/message"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/messagefactory"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/messageparser"
......@@ -17,6 +10,11 @@ import (
"github.com/iotaledger/goshimmer/packages/database"
"github.com/iotaledger/goshimmer/packages/shutdown"
"github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/hive.go/autopeering/peer"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node"
)
const (
......
......@@ -4,7 +4,9 @@ import (
"github.com/iotaledger/hive.go/events"
)
// Events defines the events of the plugin.
var Events = pluginEvents{
// ReceivedMPSUpdated triggers upon reception of a MPS update.
ReceivedMPSUpdated: events.NewEvent(uint64EventCaller),
}
......
......@@ -2,6 +2,7 @@ package profiling
import (
"net/http"
// import required to profile
_ "net/http/pprof"
"github.com/iotaledger/goshimmer/plugins/config"
......@@ -10,9 +11,11 @@ import (
)
var (
// Plugin is the profiling plugin.
Plugin = node.NewPlugin("Profiling", node.Enabled, configure, run)
)
// CfgProfilingBindAddress defines the config flag of the profiling binding address.
const CfgProfilingBindAddress = "profiling.bindAddress"
func init() {
......
// remotelog is a plugin that enables log messages being sent via UDP to a central ELK stack for debugging.
// Package remotelog is a plugin that enables log messages being sent via UDP to a central ELK stack for debugging.
// It is disabled by default and when enabled, additionally, logger.disableEvents=false in config.json needs to be set.
// The destination can be set via logger.remotelog.serverAddress.
// All events according to logger.level in config.json are sent.
......@@ -18,13 +18,11 @@ import (
"github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/goshimmer/plugins/banner"
"github.com/iotaledger/goshimmer/plugins/config"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node"
"github.com/iotaledger/hive.go/workerpool"
"gopkg.in/src-d/go-git.v4"
)
......@@ -32,7 +30,7 @@ type logMessage struct {
Version string `json:"version"`
GitHead string `json:"gitHead,omitempty"`
GitBranch string `json:"gitBranch,omitempty"`
NodeId string `json:"nodeId"`
NodeID string `json:"nodeId"`
Level string `json:"level"`
Name string `json:"name"`
Msg string `json:"msg"`
......@@ -40,7 +38,9 @@ type logMessage struct {
}
const (
// CfgServerAddress defines the config flag of the server address.
CfgServerAddress = "logger.remotelog.serverAddress"
// CfgDisableEvents defines the config flag for disabling logger events.
CfgDisableEvents = "logger.disableEvents"
// PluginName is the name of the remote log plugin.
PluginName = "RemoteLog"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment