-
Notifications
You must be signed in to change notification settings - Fork 101
Fix SonarQube string literal duplication issues #1499
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
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ import ( | |||||
| "crypto/tls" | ||||||
| "encoding/binary" | ||||||
| "encoding/json" | ||||||
| "errors" | ||||||
| "fmt" | ||||||
| "io" | ||||||
| "math" | ||||||
|
|
@@ -42,6 +43,8 @@ const defaultMaxForwardingHops = 30 | |||||
| // defaultMaxConnectionIdleTime is the maximum time a connection can go without data before we consider it failed. | ||||||
| const defaultMaxConnectionIdleTime = 2*defaultRouteUpdateTime + 1*time.Second | ||||||
|
|
||||||
| const errMustProvideName = "must provide a name" | ||||||
|
|
||||||
| // MainInstance is the global instance of Netceptor instantiated by the command-line main() function. | ||||||
| var MainInstance *Netceptor | ||||||
|
|
||||||
|
|
@@ -932,7 +935,7 @@ func (s *Netceptor) GetServerTLSConfig(name string) (*tls.Config, error) { | |||||
| // AddWorkCommand records a work command so it can be included in service announcements. | ||||||
| func (s *Netceptor) AddWorkCommand(command string, secure bool) error { | ||||||
| if command == "" { | ||||||
| return fmt.Errorf("must provide a name") | ||||||
| return errors.New(errMustProvideName) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm. I dislike that all these error messages are identical. Can we take this opportunity to mention which name is missing?
Suggested change
|
||||||
| } | ||||||
| wC := WorkCommand{WorkType: command, Secure: secure} | ||||||
| s.workCommandsLock.Lock() | ||||||
|
|
@@ -945,7 +948,7 @@ func (s *Netceptor) AddWorkCommand(command string, secure bool) error { | |||||
| // SetServerTLSConfig stores a server TLS config by name. | ||||||
| func (s *Netceptor) SetServerTLSConfig(name string, config *tls.Config) error { | ||||||
| if name == "" { | ||||||
| return fmt.Errorf("must provide a name") | ||||||
| return errors.New(errMustProvideName) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| s.serverTLSConfigs[name] = config | ||||||
|
|
||||||
|
|
@@ -984,7 +987,7 @@ func (s *Netceptor) GetClientTLSConfig(name string, expectedHostName string, exp | |||||
| // SetClientTLSConfig stores a client TLS config by name. | ||||||
| func (s *Netceptor) SetClientTLSConfig(name string, config *tls.Config, pinnedFingerprints [][]byte) error { | ||||||
| if name == "" { | ||||||
| return fmt.Errorf("must provide a name") | ||||||
| return errors.New(errMustProvideName) | ||||||
| } | ||||||
| s.clientTLSConfigs[name] = config | ||||||
| s.clientPinnedFingerprints[name] = pinnedFingerprints | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,10 @@ import ( | |
| "github.com/spf13/viper" | ||
| ) | ||
|
|
||
| const errMsgStatusFileUpdate = "Error updating status file %s: %s" | ||
| const ( | ||
| errMsgStatusFileUpdate = "Error updating status file %s: %s" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I see this error message has parameters. |
||
| receptorWorkersAppName = "receptor-workers" | ||
| ) | ||
|
|
||
| type BaseWorkUnitForWorkUnit interface { | ||
| CancelContext() | ||
|
|
@@ -537,12 +540,12 @@ func init() { | |
| if version > 1 { | ||
| return | ||
| } | ||
| cmdline.RegisterConfigTypeForApp("receptor-workers", | ||
| cmdline.RegisterConfigTypeForApp(receptorWorkersAppName, | ||
| "work-signing", "Private key to sign work submissions", SigningKeyPrivateCfg{}, cmdline.Singleton, cmdline.Section(workersSection)) | ||
| cmdline.RegisterConfigTypeForApp("receptor-workers", | ||
| cmdline.RegisterConfigTypeForApp(receptorWorkersAppName, | ||
| "work-verification", "Public key to verify work submissions", VerifyingKeyPublicCfg{}, cmdline.Singleton, cmdline.Section(workersSection)) | ||
| cmdline.RegisterConfigTypeForApp("receptor-workers", | ||
| cmdline.RegisterConfigTypeForApp(receptorWorkersAppName, | ||
| "work-command", "Run a worker using an external command", CommandWorkerCfg{}, cmdline.Section(workersSection)) | ||
| cmdline.RegisterConfigTypeForApp("receptor-workers", | ||
| cmdline.RegisterConfigTypeForApp(receptorWorkersAppName, | ||
| "command-runner", "Wrapper around a process invocation", commandRunnerCfg{}, cmdline.Hidden) | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.