diff --git a/dapps/faucet/dapp.go b/dapps/faucet/dapp.go index a1d376c2b846ba011b8198db631ea61bfade1750..a4f736552d70bdd39b5429d0b9e6ddca0d2904be 100644 --- a/dapps/faucet/dapp.go +++ b/dapps/faucet/dapp.go @@ -6,7 +6,7 @@ import ( "time" faucet "github.com/iotaledger/goshimmer/dapps/faucet/packages" - "github.com/iotaledger/goshimmer/dapps/faucet/packages/payload" + faucetpayload "github.com/iotaledger/goshimmer/dapps/faucet/packages/payload" "github.com/iotaledger/goshimmer/packages/binary/messagelayer/message" "github.com/iotaledger/goshimmer/packages/binary/messagelayer/tangle" "github.com/iotaledger/goshimmer/packages/shutdown" diff --git a/dapps/networkdelay/dapp.go b/dapps/networkdelay/dapp.go index 5912befe05d2f28d70cba95a75da5c09ed1db72d..426f5da498b7242eeff3fc01257f3ce13f450ab6 100644 --- a/dapps/networkdelay/dapp.go +++ b/dapps/networkdelay/dapp.go @@ -29,7 +29,7 @@ const ( var ( // App is the "plugin" instance of the network delay application. - app *node.Plugin + app *node.Plugin once sync.Once // log holds a reference to the logger used by this app. @@ -44,8 +44,8 @@ var ( // App gets the plugin instance. func App() *node.Plugin { - once.Do(func () { - app = node.NewPlugin(PluginName, node.Disabled, configure) + once.Do(func() { + app = node.NewPlugin(PluginName, node.Disabled, configure) }) return app } diff --git a/dapps/valuetransfers/packages/transaction/outputid.go b/dapps/valuetransfers/packages/transaction/outputid.go index b8386d60dbc42dfbbb7bb78a73481fb14999284f..4d6aff44511f87566350219356b0aa76f195bd6e 100644 --- a/dapps/valuetransfers/packages/transaction/outputid.go +++ b/dapps/valuetransfers/packages/transaction/outputid.go @@ -2,11 +2,10 @@ package transaction import ( "fmt" - "github.com/mr-tron/base58" - - "github.com/iotaledger/hive.go/marshalutil" "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/address" + "github.com/iotaledger/hive.go/marshalutil" + "github.com/mr-tron/base58" ) // OutputID is the data type that represents the identifier for a Output. diff --git a/dapps/valuetransfers/packages/transaction/outputs.go b/dapps/valuetransfers/packages/transaction/outputs.go index 4cd77a3ff3962de5e9afb161117f1f420d8da24e..f287b1839b305c7f6057e5a29b7c050c60ed1381 100644 --- a/dapps/valuetransfers/packages/transaction/outputs.go +++ b/dapps/valuetransfers/packages/transaction/outputs.go @@ -2,13 +2,12 @@ package transaction import ( "bytes" - "github.com/iotaledger/hive.go/marshalutil" "sort" "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/address" - "github.com/iotaledger/goshimmer/packages/binary/datastructure/orderedmap" - "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/balance" + "github.com/iotaledger/goshimmer/packages/binary/datastructure/orderedmap" + "github.com/iotaledger/hive.go/marshalutil" ) // Outputs represents a list of Outputs that are part of a transaction. diff --git a/packages/gossip/events.go b/packages/gossip/events.go index 93875d68c290387327e4411b2c2dab86c798d1af..96f303c60a4e2aa89dd6aa17271a921af39c9bad 100644 --- a/packages/gossip/events.go +++ b/packages/gossip/events.go @@ -29,10 +29,6 @@ func peerAndErrorCaller(handler interface{}, params ...interface{}) { handler.(func(*peer.Peer, error))(params[0].(*peer.Peer), params[1].(error)) } -func peerCaller(handler interface{}, params ...interface{}) { - handler.(func(*peer.Peer))(params[0].(*peer.Peer)) -} - func neighborCaller(handler interface{}, params ...interface{}) { handler.(func(*Neighbor))(params[0].(*Neighbor)) } diff --git a/plugins/analysis/client/plugin.go b/plugins/analysis/client/plugin.go index 734e3507fe7d6e8db04e0899f8e5d536758c93e3..0761a9a945f00c9c867c7434e9e0c7ecbb91a279 100644 --- a/plugins/analysis/client/plugin.go +++ b/plugins/analysis/client/plugin.go @@ -32,11 +32,10 @@ func init() { var ( // plugin is the plugin instance of the analysis client plugin. - plugin *node.Plugin - once sync.Once - log *logger.Logger - conn *Connector - connLock sync.Mutex + plugin *node.Plugin + once sync.Once + log *logger.Logger + conn *Connector ) // Plugin gets the plugin instance diff --git a/plugins/analysis/packet/fpc_heartbeat.go b/plugins/analysis/packet/fpc_heartbeat.go index 3c64aafc285011f91258e7717798225508a1adbd..a02f508435fea88b535af97d1dac69cf3802109f 100644 --- a/plugins/analysis/packet/fpc_heartbeat.go +++ b/plugins/analysis/packet/fpc_heartbeat.go @@ -5,6 +5,7 @@ import ( "encoding/binary" "encoding/gob" "errors" + "github.com/iotaledger/goshimmer/packages/vote" "github.com/iotaledger/hive.go/protocol/message" "github.com/iotaledger/hive.go/protocol/tlv" @@ -30,7 +31,7 @@ type FPCHeartbeat struct { func FPCHeartbeatMessageDefinition() *message.Definition { // fpcHeartbeatMessageDefinition defines a heartbeat message's format. var fpcHeartbeatMessageDefinition *message.Definition - fpcHeartBeatOnce.Do(func(){ + fpcHeartBeatOnce.Do(func() { fpcHeartbeatMessageDefinition = &message.Definition{ ID: MessageTypeFPCHeartbeat, MaxBytesLength: 65535, diff --git a/plugins/analysis/packet/heartbeat.go b/plugins/analysis/packet/heartbeat.go index 65f75e56358168c3f94f9a88ea5cd89e4279396e..49fe1c066fe164f5674c0b792edf803d3a0c6e56 100644 --- a/plugins/analysis/packet/heartbeat.go +++ b/plugins/analysis/packet/heartbeat.go @@ -6,6 +6,7 @@ import ( "encoding/binary" "errors" "fmt" + "github.com/iotaledger/hive.go/protocol/message" "github.com/iotaledger/hive.go/protocol/tlv" ) @@ -31,7 +32,6 @@ const ( HeartbeatMaxOutboundPeersCount*sha256.Size + HeartbeatMaxInboundPeersCount*sha256.Size ) - // Heartbeat represents a heartbeat packet. type Heartbeat struct { // The ID of the node who sent the heartbeat. @@ -46,10 +46,10 @@ type Heartbeat struct { } // HeartBeatMessageDefinition gets the heartbeatMessageDefinition. -func HeartBeatMessageDefinition() *message.Definition{ +func HeartBeatMessageDefinition() *message.Definition { // heartbeatMessageDefinition defines a heartbeat message's format. var heartbeatMessageDefinition *message.Definition - heartBeatOnce.Do(func(){ + heartBeatOnce.Do(func() { heartbeatMessageDefinition = &message.Definition{ ID: MessageTypeHeartbeat, MaxBytesLength: uint16(HeartbeatPacketMaxSize), diff --git a/plugins/autopeering/plugin.go b/plugins/autopeering/plugin.go index c100b9768b4abae3da9ed6276a5421ee2ea804cc..40c31a2bb4af6dbe8c024832348bfcbdf72ec355 100644 --- a/plugins/autopeering/plugin.go +++ b/plugins/autopeering/plugin.go @@ -19,7 +19,7 @@ const PluginName = "Autopeering" var ( // plugin is the plugin instance of the autopeering plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger ) @@ -27,7 +27,7 @@ var ( // Plugin gets the plugin instance. func Plugin() *node.Plugin { once.Do(func() { - plugin = node.NewPlugin(PluginName, node.Enabled, configure, run) + plugin = node.NewPlugin(PluginName, node.Enabled, configure, run) }) return plugin } diff --git a/plugins/banner/plugin.go b/plugins/banner/plugin.go index f71fab08b3d5c946700d24ff87a47726682c0a98..5603df69d13a2c1fadc32ce202ac620178fb142a 100644 --- a/plugins/banner/plugin.go +++ b/plugins/banner/plugin.go @@ -13,7 +13,7 @@ const PluginName = "Banner" var ( // plugin is the plugin instance of the banner plugin. plugin *node.Plugin - once sync.Once + once sync.Once ) const ( @@ -27,7 +27,7 @@ const ( // Plugin gets the plugin instance. func Plugin() *node.Plugin { once.Do(func() { - plugin = node.NewPlugin(PluginName, node.Disabled, configure, run) + plugin = node.NewPlugin(PluginName, node.Disabled, configure, run) }) return plugin } diff --git a/plugins/bootstrap/plugin.go b/plugins/bootstrap/plugin.go index c1aab9ddcbd8aa4c8f51aa79c023e285108a5a06..c16ffe224b4f1c55ac89af0e279b867aef3ab12b 100644 --- a/plugins/bootstrap/plugin.go +++ b/plugins/bootstrap/plugin.go @@ -35,14 +35,14 @@ func init() { var ( // plugin is the plugin instance of the bootstrap plugin. plugin *node.Plugin - once goSync.Once + once goSync.Once log *logger.Logger ) // Plugin gets the plugin instance. func Plugin() *node.Plugin { once.Do(func() { - plugin = node.NewPlugin(PluginName, node.Disabled, configure, run) + plugin = node.NewPlugin(PluginName, node.Disabled, configure, run) }) return plugin } diff --git a/plugins/cli/plugin.go b/plugins/cli/plugin.go index 8946d22b12173110418873b919446ee8870759bf..168aa3d33482fb6cdf2358ac5176b007c8700ebc 100644 --- a/plugins/cli/plugin.go +++ b/plugins/cli/plugin.go @@ -5,11 +5,10 @@ import ( "os" "sync" + "github.com/iotaledger/goshimmer/plugins/banner" "github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/node" flag "github.com/spf13/pflag" - - "github.com/iotaledger/goshimmer/plugins/banner" ) // PluginName is the name of the CLI plugin. @@ -18,7 +17,7 @@ const PluginName = "CLI" var ( // plugin is the plugin instance of the CLI plugin. plugin *node.Plugin - once sync.Once + once sync.Once version = flag.BoolP("version", "v", false, "Prints the GoShimmer version") ) diff --git a/plugins/config/plugin.go b/plugins/config/plugin.go index 151ed747fe9d2c8677a5417d991ae754f71b2106..76b2cf7e80deefef0b058ceef5bd4ba4d1b561a4 100644 --- a/plugins/config/plugin.go +++ b/plugins/config/plugin.go @@ -27,7 +27,7 @@ var ( skipConfigAvailable = flag.Bool("skip-config", false, "Skip config file availability check") // Node is viper - _node *viper.Viper + _node *viper.Viper nodeOnce sync.Once ) @@ -57,7 +57,6 @@ func init() { _node = Node() plugin = Plugin() - plugin.Events.Init.Attach(events.NewClosure(func(*node.Plugin) { if err := fetch(false); err != nil { if !*skipConfigAvailable { diff --git a/plugins/dashboard/plugin.go b/plugins/dashboard/plugin.go index b19aaf9ac79041b3507278a532c3a0b0e53290be..64553804bef0ff5b7e403b2363f03e32224a7d31 100644 --- a/plugins/dashboard/plugin.go +++ b/plugins/dashboard/plugin.go @@ -33,7 +33,7 @@ const PluginName = "Dashboard" var ( // plugin is the plugin instance of the dashboard plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger server *echo.Echo diff --git a/plugins/drng/plugin.go b/plugins/drng/plugin.go index 041c1d5d0c52ef10f60db8178e216343cd7c5161..55deeafbf8c9f7063673bb3421ab00ec53509db5 100644 --- a/plugins/drng/plugin.go +++ b/plugins/drng/plugin.go @@ -20,11 +20,11 @@ const PluginName = "DRNG" var ( // plugin is the plugin instance of the DRNG plugin. - plugin *node.Plugin + plugin *node.Plugin pluginOnce sync.Once - instance *drng.DRNG - once sync.Once - log *logger.Logger + instance *drng.DRNG + once sync.Once + log *logger.Logger ) // Plugin gets the plugin instance. @@ -35,7 +35,6 @@ func Plugin() *node.Plugin { return plugin } - func configure(_ *node.Plugin) { configureEvents() } diff --git a/plugins/gossip/plugin.go b/plugins/gossip/plugin.go index 4e62dc9aa548c3acf6c2a3e35669882aaaa8f765..d32ad25341a99bdb1c72d93a9f4046771ece4259 100644 --- a/plugins/gossip/plugin.go +++ b/plugins/gossip/plugin.go @@ -1,6 +1,8 @@ package gossip import ( + "sync" + "github.com/iotaledger/goshimmer/packages/binary/messagelayer/message" "github.com/iotaledger/goshimmer/packages/binary/messagelayer/tangle" "github.com/iotaledger/goshimmer/packages/gossip" @@ -13,7 +15,6 @@ import ( "github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" - "sync" ) // PluginName is the name of the gossip plugin. @@ -22,7 +23,7 @@ const PluginName = "Gossip" var ( // plugin is the plugin instance of the gossip plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger ) @@ -35,7 +36,6 @@ func Plugin() *node.Plugin { return plugin } - func configure(*node.Plugin) { log = logger.NewLogger(PluginName) diff --git a/plugins/gracefulshutdown/plugin.go b/plugins/gracefulshutdown/plugin.go index efa546494613457530faeeb0309693aa954d1d4b..efc50f743957b8bf6308429096e4c2eb232ee49c 100644 --- a/plugins/gracefulshutdown/plugin.go +++ b/plugins/gracefulshutdown/plugin.go @@ -23,9 +23,9 @@ const WaitToKillTimeInSeconds = 60 var ( // plugin is the plugin instance of the graceful shutdown plugin. - plugin *node.Plugin - once sync.Once - log *logger.Logger + plugin *node.Plugin + once sync.Once + log *logger.Logger gracefulStop chan os.Signal ) @@ -45,8 +45,11 @@ func Plugin() *node.Plugin { log.Warnf("Received shutdown request - waiting (max %d) to finish processing ...", WaitToKillTimeInSeconds) go func() { + ticker := time.NewTicker(1 * time.Second) + defer ticker.Stop() + start := time.Now() - for x := range time.Tick(1 * time.Second) { + for x := range ticker.C { secondsSinceStart := x.Sub(start).Seconds() if secondsSinceStart <= WaitToKillTimeInSeconds { @@ -71,7 +74,6 @@ func Plugin() *node.Plugin { return plugin } - // ShutdownWithError prints out an error message and shuts down the default daemon instance. func ShutdownWithError(err error) { log.Error(err) diff --git a/plugins/issuer/plugin.go b/plugins/issuer/plugin.go index 8bc87008fb963db0da6737cc7ebfe52dbe12efc7..85a997f99e514ab8c4482511107facb702be24f4 100644 --- a/plugins/issuer/plugin.go +++ b/plugins/issuer/plugin.go @@ -17,8 +17,7 @@ const PluginName = "Issuer" var ( // plugin is the plugin instance of the issuer plugin. plugin *node.Plugin - once goSync.Once - + once goSync.Once ) // Plugin gets the plugin instance. diff --git a/plugins/logger/plugin.go b/plugins/logger/plugin.go index 5ab85c84f05b9e926536fc3998f88b48d7c8bbf3..f05107bf69ebcd13e299c564583755d3d29cb785 100644 --- a/plugins/logger/plugin.go +++ b/plugins/logger/plugin.go @@ -1,11 +1,12 @@ package logger import ( + "sync" + "github.com/iotaledger/goshimmer/plugins/config" "github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" - "sync" ) // PluginName is the name of the logger plugin. @@ -14,7 +15,7 @@ const PluginName = "Logger" var ( // plugin is the plugin instance of the logger plugin. plugin *node.Plugin - once sync.Once + once sync.Once ) // Plugin gets the plugin instance. @@ -25,7 +26,6 @@ func Plugin() *node.Plugin { return plugin } - // Init triggers the Init event. func Init() { plugin.Events.Init.Trigger(plugin) diff --git a/plugins/portcheck/plugin.go b/plugins/portcheck/plugin.go index e1b6845b0c9f000e19a720876afe5756a24749d6..ebfe045bf954be4f4175f6824c9c0991516128a1 100644 --- a/plugins/portcheck/plugin.go +++ b/plugins/portcheck/plugin.go @@ -20,7 +20,7 @@ const PluginName = "PortCheck" var ( // plugin is the plugin instance of the port check plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger ) diff --git a/plugins/profiling/plugin.go b/plugins/profiling/plugin.go index 4ab416d6e41f3bad7750d2ef7cd9ff3a6c015714..4035e2df98bec4c8fb0eb3b51a900f6d69a1a1de 100644 --- a/plugins/profiling/plugin.go +++ b/plugins/profiling/plugin.go @@ -20,7 +20,7 @@ const PluginName = "Profiling" var ( // plugin is the profiling plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger ) diff --git a/plugins/remotelog/plugin.go b/plugins/remotelog/plugin.go index fee332330ce1080ae9e4dfa505405c5c386ce746..35e8e8fc481accb7329a9bd59e6f8da0443ec9dc 100644 --- a/plugins/remotelog/plugin.go +++ b/plugins/remotelog/plugin.go @@ -38,7 +38,7 @@ const ( var ( // plugin is the plugin instance of the remote plugin instance. plugin *node.Plugin - pluginOnce sync.Once + pluginOnce sync.Once log *logger.Logger myID string myGitHead string diff --git a/plugins/sync/plugin.go b/plugins/sync/plugin.go index 738285a9dea335578d4e3f2d0488cc07df42b45d..b44f9d210717437c6c0c91cf6e0a79100f1d8ae7 100644 --- a/plugins/sync/plugin.go +++ b/plugins/sync/plugin.go @@ -51,7 +51,7 @@ func init() { var ( // plugin is the plugin instance of the sync plugin. plugin *node.Plugin - once sync.Once + once sync.Once // ErrNodeNotSynchronized is returned when an operation can't be executed because // the node is not synchronized. ErrNodeNotSynchronized = errors.New("node is not synchronized") @@ -145,8 +145,8 @@ func monitorForDesynchronization() { messagelayer.Tangle().Events.MessageAttached.Attach(monitorMessageInflowClosure) defer messagelayer.Tangle().Events.MessageAttached.Detach(monitorMessageInflowClosure) - desyncedIfNoMessageInSec := config.Node().GetDuration(CfgSyncDesyncedIfNoMessageAfterSec) * time.Second - timer := time.NewTimer(desyncedIfNoMessageInSec) + timeForDesync := config.Node().GetDuration(CfgSyncDesyncedIfNoMessageAfterSec) * time.Second + timer := time.NewTimer(timeForDesync) for { select { @@ -156,10 +156,10 @@ func monitorForDesynchronization() { <-timer.C } // TODO: perhaps find a better way instead of constantly resetting the timer - timer.Reset(desyncedIfNoMessageInSec) + timer.Reset(timeForDesync) case <-timer.C: - log.Infof("no message received in %d seconds, marking node as desynced", int(desyncedIfNoMessageInSec.Seconds())) + log.Infof("no message received in %d seconds, marking node as desynced", int(timeForDesync.Seconds())) markDesynced() return diff --git a/plugins/webapi/autopeering/plugin.go b/plugins/webapi/autopeering/plugin.go index 9b046602fe5a00cafbc752b64f60ea7a1c72cbb0..512a5c25d0f7b419b00dfe08b4360d1ae03566b4 100644 --- a/plugins/webapi/autopeering/plugin.go +++ b/plugins/webapi/autopeering/plugin.go @@ -20,7 +20,7 @@ const PluginName = "WebAPI autopeering Endpoint" var ( // plugin is the plugin instance of the web API autopeering endpoint plugin. plugin *node.Plugin - once sync.Once + once sync.Once ) func configure(plugin *node.Plugin) { diff --git a/plugins/webapi/data/plugin.go b/plugins/webapi/data/plugin.go index 91f683f5299017a731db018a1cdeb0d17b072320..a13ecce6b59ef7223fc9055afb646367e530cec0 100644 --- a/plugins/webapi/data/plugin.go +++ b/plugins/webapi/data/plugin.go @@ -18,7 +18,7 @@ const PluginName = "WebAPI data Endpoint" var ( // plugin is the plugin instance of the web API data endpoint plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger ) diff --git a/plugins/webapi/drng/info/committee/handler.go b/plugins/webapi/drng/info/committee/handler.go index 6462e8a6cd743be2ed3618e8a434e9d08da7024a..cc46699296f755ab7ccb1403e5600f1afc95a1dd 100644 --- a/plugins/webapi/drng/info/committee/handler.go +++ b/plugins/webapi/drng/info/committee/handler.go @@ -23,7 +23,7 @@ func Handler(c echo.Context) error { type Response struct { InstanceID uint32 `json:"instanceID,omitempty"` Threshold uint8 `json:"threshold,omitempty"` - Identities []ed25519.PublicKey `json:"identitites,omitempty"` + Identities []ed25519.PublicKey `json:"identities,omitempty"` DistributedPK []byte `json:"distributedPK,omitempty"` Error string `json:"error,omitempty"` } diff --git a/plugins/webapi/drng/plugin.go b/plugins/webapi/drng/plugin.go index d2a89ec67c693e31dbdda4c0ad2e48d5a95d2a27..ccbcc152f9c919acbe08c019e1d630ffd64f6668 100644 --- a/plugins/webapi/drng/plugin.go +++ b/plugins/webapi/drng/plugin.go @@ -1,12 +1,13 @@ package drng import ( + "sync" + "github.com/iotaledger/goshimmer/plugins/webapi" "github.com/iotaledger/goshimmer/plugins/webapi/drng/collectivebeacon" "github.com/iotaledger/goshimmer/plugins/webapi/drng/info/committee" "github.com/iotaledger/goshimmer/plugins/webapi/drng/info/randomness" "github.com/iotaledger/hive.go/node" - "sync" ) // PluginName is the name of the web API DRNG endpoint plugin. @@ -15,7 +16,7 @@ const PluginName = "WebAPI DRNG Endpoint" var ( // plugin is the plugin instance of the web API DRNG endpoint plugin. plugin *node.Plugin - once sync.Once + once sync.Once ) // Plugin gets the plugin instance. diff --git a/plugins/webapi/healthz/plugin.go b/plugins/webapi/healthz/plugin.go index d0c859d4771ed3762821ba5ca42242894b2b85ff..d81d90edf8aac73b34207635def36d24914385aa 100644 --- a/plugins/webapi/healthz/plugin.go +++ b/plugins/webapi/healthz/plugin.go @@ -17,8 +17,9 @@ const PluginName = "WebAPI healthz Endpoint" var ( // plugin is the plugin instance of the web API info endpoint plugin. plugin *node.Plugin - once goSync.Once + once goSync.Once ) + // Plugin gets the plugin instance. func Plugin() *node.Plugin { once.Do(func() { diff --git a/plugins/webapi/info/plugin.go b/plugins/webapi/info/plugin.go index 8c2053d0fc90236802cca9ecc6821263b20b4019..a64f121b790023fb34a3e45b2607e72cbe913b23 100644 --- a/plugins/webapi/info/plugin.go +++ b/plugins/webapi/info/plugin.go @@ -19,7 +19,7 @@ const PluginName = "WebAPI info Endpoint" var ( // plugin is the plugin instance of the web API info endpoint plugin. plugin *node.Plugin - once goSync.Once + once goSync.Once ) // Plugin gets the plugin instance. diff --git a/plugins/webapi/plugin.go b/plugins/webapi/plugin.go index 73482f88a02bc766688f62c69e56a6e1c74d5030..24074bf6193a7e8272fe7fc93be44cf36c298a36 100644 --- a/plugins/webapi/plugin.go +++ b/plugins/webapi/plugin.go @@ -23,7 +23,7 @@ var ( plugin *node.Plugin pluginOnce sync.Once // server is the web API server. - server *echo.Echo + server *echo.Echo serverOnce sync.Once log *logger.Logger diff --git a/plugins/webapi/spammer/plugin.go b/plugins/webapi/spammer/plugin.go index 248338f641745de3ead979261703e38d14dff8d0..80a540d1d48755a58454a38d9eb4ea931c051c34 100644 --- a/plugins/webapi/spammer/plugin.go +++ b/plugins/webapi/spammer/plugin.go @@ -1,6 +1,8 @@ package spammer import ( + "sync" + "github.com/iotaledger/goshimmer/packages/binary/spammer" "github.com/iotaledger/goshimmer/packages/shutdown" "github.com/iotaledger/goshimmer/plugins/issuer" @@ -8,7 +10,6 @@ import ( "github.com/iotaledger/hive.go/daemon" "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" - "sync" ) var messageSpammer *spammer.Spammer @@ -19,8 +20,8 @@ const PluginName = "Spammer" var ( // plugin is the plugin instance of the spammer plugin. plugin *node.Plugin - once sync.Once - log *logger.Logger + once sync.Once + log *logger.Logger ) // Plugin gets the plugin instance. diff --git a/plugins/webapi/value/plugin.go b/plugins/webapi/value/plugin.go index 4fcdf40e9b06d51701fad95ca9607a9f96992c5c..f9f4cb9b16b70f835a275b30528b27703e9a54d4 100644 --- a/plugins/webapi/value/plugin.go +++ b/plugins/webapi/value/plugin.go @@ -1,6 +1,8 @@ package value import ( + "sync" + "github.com/iotaledger/goshimmer/plugins/webapi" "github.com/iotaledger/goshimmer/plugins/webapi/value/attachments" "github.com/iotaledger/goshimmer/plugins/webapi/value/gettransactionbyid" @@ -8,7 +10,6 @@ import ( "github.com/iotaledger/goshimmer/plugins/webapi/value/testsendtxn" "github.com/iotaledger/goshimmer/plugins/webapi/value/unspentoutputs" "github.com/iotaledger/hive.go/node" - "sync" ) // PluginName is the name of the web API DRNG endpoint plugin. @@ -17,7 +18,7 @@ const PluginName = "WebAPI Value Endpoint" var ( // plugin is the plugin instance of the web API DRNG endpoint plugin. plugin *node.Plugin - once sync.Once + once sync.Once ) // Plugin gets the plugin instance. diff --git a/plugins/webauth/webauth.go b/plugins/webauth/webauth.go index a337d7ba34cc5a44ca427c4484441fe7ba60ac8c..25321d29a2864c6ae277dfac83a4652935cd23e2 100644 --- a/plugins/webauth/webauth.go +++ b/plugins/webauth/webauth.go @@ -21,7 +21,7 @@ const PluginName = "WebAPI Auth" var ( // plugin is the plugin instance of the web API auth plugin. plugin *node.Plugin - once sync.Once + once sync.Once log *logger.Logger privateKey string )