From 10cfaada3c32e1abe7907edca2ca3b30569a1df4 Mon Sep 17 00:00:00 2001 From: nicozingarelli Date: Tue, 22 May 2018 15:00:58 -0700 Subject: [PATCH] cmd: fixed comment should be in form and receiver name messages from golint in the module --- cmd/swarm/config.go | 4 ++-- cmd/swarm/main.go | 2 +- cmd/utils/customflags.go | 34 +++++++++++++++++----------------- cmd/utils/flags.go | 24 ++++++++++++------------ 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index adac772bab..d06eee673a 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -38,7 +38,7 @@ import ( ) var ( - //flag definition for the dumpconfig command + // DumpConfigCommand flag definition for the dumpconfig command DumpConfigCommand = cli.Command{ Action: utils.MigrateFlags(dumpConfig), Name: "dumpconfig", @@ -49,7 +49,7 @@ var ( Description: `The dumpconfig command shows configuration values.`, } - //flag definition for the config file command + // SwarmTomlConfigPathFlag flag definition for the config file command SwarmTomlConfigPathFlag = cli.StringFlag{ Name: "config", Usage: "TOML configuration file", diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go index 360020b77b..47c8f6c8e4 100644 --- a/cmd/swarm/main.go +++ b/cmd/swarm/main.go @@ -142,7 +142,7 @@ var ( EnvVar: SWARM_ENV_CORS, } - // the following flags are deprecated and should be removed in the future + // DeprecatedEthAPIFlag the following flags are deprecated and should be removed in the future DeprecatedEthAPIFlag = cli.StringFlag{ Name: "ethapi", Usage: "DEPRECATED: please use --ens-api and --swap-api", diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index e5bf8724c1..361319c3ec 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -31,23 +31,23 @@ import ( "gopkg.in/urfave/cli.v1" ) -// Custom type which is registered in the flags library which cli uses for +// DirectoryString custom type which is registered in the flags library which cli uses for // argument parsing. This allows us to expand Value to an absolute path when // the argument is parsed type DirectoryString struct { Value string } -func (self *DirectoryString) String() string { - return self.Value +func (ds *DirectoryString) String() string { + return ds.Value } -func (self *DirectoryString) Set(value string) error { - self.Value = expandPath(value) +func (ds *DirectoryString) Set(value string) error { + ds.Value = expandPath(value) return nil } -// Custom cli.Flag type which expand the received string to an absolute path. +// DirectoryFlag custom cli.Flag type which expand the received string to an absolute path. // e.g. ~/.ethereum -> /home/username/.ethereum type DirectoryFlag struct { Name string @@ -55,12 +55,12 @@ type DirectoryFlag struct { Usage string } -func (self DirectoryFlag) String() string { +func (df DirectoryFlag) String() string { fmtString := "%s %v\t%v" - if len(self.Value.Value) > 0 { + if len(df.Value.Value) > 0 { fmtString = "%s \"%v\"\t%v" } - return fmt.Sprintf(fmtString, prefixedNames(self.Name), self.Value.Value, self.Usage) + return fmt.Sprintf(fmtString, prefixedNames(df.Name), df.Value.Value, df.Usage) } func eachName(longName string, fn func(string)) { @@ -71,11 +71,11 @@ func eachName(longName string, fn func(string)) { } } -// called by cli library, grabs variable from environment (if in env) +// Apply called by cli library, grabs variable from environment (if in env) // and adds variable to flag set for parsing. -func (self DirectoryFlag) Apply(set *flag.FlagSet) { - eachName(self.Name, func(name string) { - set.Var(&self.Value, self.Name, self.Usage) +func (df DirectoryFlag) Apply(set *flag.FlagSet) { + eachName(df.Name, func(name string) { + set.Var(&df.Value, df.Name, df.Usage) }) } @@ -207,12 +207,12 @@ func prefixedNames(fullName string) (prefixed string) { return } -func (self DirectoryFlag) GetName() string { - return self.Name +func (df DirectoryFlag) GetName() string { + return df.Name } -func (self *DirectoryFlag) Set(value string) { - self.Value.Value = value +func (df *DirectoryFlag) Set(value string) { + df.Value.Value = value } // Expands a file path diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index ef5f6a9f08..aff9c4d78f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -112,7 +112,7 @@ func NewApp(gitCommit, usage string) *cli.App { // are the same for all commands. var ( - // General settings + // DataDirFlag general settings DataDirFlag = DirectoryFlag{ Name: "datadir", Usage: "Data directory for the databases and keystore", @@ -189,7 +189,7 @@ var ( Name: "lightkdf", Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", } - // Dashboard settings + // DashboardEnabledFlag dashboard settings DashboardEnabledFlag = cli.BoolFlag{ Name: "dashboard", Usage: "Enable the dashboard", @@ -209,7 +209,7 @@ var ( Usage: "Dashboard metrics collection refresh rate", Value: dashboard.DefaultConfig.Refresh, } - // Ethash settings + // EthashCacheDirFlag ethash settings EthashCacheDirFlag = DirectoryFlag{ Name: "ethash.cachedir", Usage: "Directory to store the ethash verification caches (default = inside the datadir)", @@ -239,7 +239,7 @@ var ( Usage: "Number of recent ethash mining DAGs to keep on disk (1+GB each)", Value: eth.DefaultConfig.Ethash.DatasetsOnDisk, } - // Transaction pool settings + // TxPoolNoLocalsFlag transaction pool settings TxPoolNoLocalsFlag = cli.BoolFlag{ Name: "txpool.nolocals", Usage: "Disables price exemptions for locally submitted transactions", @@ -289,7 +289,7 @@ var ( Usage: "Maximum amount of time non-executable transaction are queued", Value: eth.DefaultConfig.TxPool.Lifetime, } - // Performance tuning settings + // CacheFlag performance tuning settings CacheFlag = cli.IntFlag{ Name: "cache", Usage: "Megabytes of memory allocated to internal caching", @@ -310,7 +310,7 @@ var ( Usage: "Number of trie node generations to keep in memory", Value: int(state.MaxTrieCacheGen), } - // Miner settings + // MiningEnabledFlag miner settings MiningEnabledFlag = cli.BoolFlag{ Name: "mine", Usage: "Enable mining", @@ -339,7 +339,7 @@ var ( Name: "extradata", Usage: "Block extra data set by the miner (default = client version)", } - // Account settings + // UnlockedAccountFlag account settings UnlockedAccountFlag = cli.StringFlag{ Name: "unlock", Usage: "Comma separated list of accounts to unlock", @@ -355,7 +355,7 @@ var ( Name: "vmdebug", Usage: "Record information useful for VM and contract debugging", } - // Logging and debug settings + // EthStatsURLFlag logging and debug settings EthStatsURLFlag = cli.StringFlag{ Name: "ethstats", Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)", @@ -372,7 +372,7 @@ var ( Name: "nocompaction", Usage: "Disables db compaction after import", } - // RPC settings + // RPCEnabledFlag RPC settings RPCEnabledFlag = cli.BoolFlag{ Name: "rpc", Usage: "Enable the HTTP-RPC server", @@ -443,7 +443,7 @@ var ( Usage: "Comma separated list of JavaScript files to preload into the console", } - // Network Settings + // MaxPeersFlag network settings MaxPeersFlag = cli.IntFlag{ Name: "maxpeers", Usage: "Maximum number of network peers (network disabled if set to 0)", @@ -500,14 +500,14 @@ var ( Usage: "Restricts network communication to the given IP networks (CIDR masks)", } - // ATM the url is left to the user and deployment to + // JSpathFlag ATM the url is left to the user and deployment to JSpathFlag = cli.StringFlag{ Name: "jspath", Usage: "JavaScript root path for `loadScript`", Value: ".", } - // Gas price oracle settings + // GpoBlocksFlag gas price oracle settings GpoBlocksFlag = cli.IntFlag{ Name: "gpoblocks", Usage: "Number of recent blocks to check for gas prices",