diff options
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/core/auth/credential.go | 5 | ||||
-rw-r--r-- | bridge/core/bridge.go | 10 | ||||
-rw-r--r-- | bridge/github/config.go | 5 | ||||
-rw-r--r-- | bridge/github/import.go | 2 | ||||
-rw-r--r-- | bridge/gitlab/config.go | 5 | ||||
-rw-r--r-- | bridge/launchpad/config.go | 5 |
6 files changed, 7 insertions, 25 deletions
diff --git a/bridge/core/auth/credential.go b/bridge/core/auth/credential.go index 2814e94c..d95b23c7 100644 --- a/bridge/core/auth/credential.go +++ b/bridge/core/auth/credential.go @@ -171,10 +171,7 @@ func List(repo repository.RepoConfig, opts ...Option) ([]Credential, error) { return nil, err } - re, err := regexp.Compile(`^` + configKeyPrefix + `\.([^.]+)\.([^.]+(?:\.[^.]+)*)$`) - if err != nil { - panic(err) - } + re := regexp.MustCompile(`^` + configKeyPrefix + `\.([^.]+)\.([^.]+(?:\.[^.]+)*)$`) mapped := make(map[string]map[string]string) diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index 10f6b109..8c1f9714 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -155,10 +155,7 @@ func ConfiguredBridges(repo repository.RepoConfig) ([]string, error) { return nil, errors.Wrap(err, "can't read configured bridges") } - re, err := regexp.Compile(bridgeConfigKeyPrefix + `.([^.]+)`) - if err != nil { - panic(err) - } + re := regexp.MustCompile(bridgeConfigKeyPrefix + `.([^.]+)`) set := make(map[string]interface{}) @@ -194,10 +191,7 @@ func BridgeExist(repo repository.RepoConfig, name string) bool { // Remove a configured bridge func RemoveBridge(repo repository.RepoConfig, name string) error { - re, err := regexp.Compile(`^[a-zA-Z0-9]+`) - if err != nil { - panic(err) - } + re := regexp.MustCompile(`^[a-zA-Z0-9]+`) if !re.MatchString(name) { return fmt.Errorf("bad bridge fullname: %s", name) diff --git a/bridge/github/config.go b/bridge/github/config.go index 0093ec38..a7af3c02 100644 --- a/bridge/github/config.go +++ b/bridge/github/config.go @@ -289,10 +289,7 @@ func promptToken() (*auth.Token, error) { fmt.Println(" - 'repo' : to be able to read private repositories") fmt.Println() - re, err := regexp.Compile(`^[a-zA-Z0-9]{40}$`) - if err != nil { - panic("regexp compile:" + err.Error()) - } + re := regexp.MustCompile(`^[a-zA-Z0-9]{40}$`) var login string diff --git a/bridge/github/import.go b/bridge/github/import.go index 58fec98c..7aec809f 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -165,7 +165,7 @@ func (gi *githubImporter) ensureIssue(repo *cache.RepoCache, issue issueTimeline b, _, err = repo.NewBugRaw( author, issue.CreatedAt.Unix(), - issue.Title, + issue.Title, // TODO: this is the *current* title, not the original one cleanText, nil, map[string]string{ diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go index 7d0e9a2f..8d2490b8 100644 --- a/bridge/gitlab/config.go +++ b/bridge/gitlab/config.go @@ -187,10 +187,7 @@ func promptToken(baseUrl string) (*auth.Token, error) { fmt.Println("'api' access scope: to be able to make api calls") fmt.Println() - re, err := regexp.Compile(`^[a-zA-Z0-9\-\_]{20}$`) - if err != nil { - panic("regexp compile:" + err.Error()) - } + re := regexp.MustCompile(`^[a-zA-Z0-9\-\_]{20}$`) var login string diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go index 006c7fce..0bf8dc0d 100644 --- a/bridge/launchpad/config.go +++ b/bridge/launchpad/config.go @@ -90,10 +90,7 @@ func validateProject(project string) (bool, error) { // extract project name from url func splitURL(url string) (string, error) { - re, err := regexp.Compile(`launchpad\.net[\/:]([^\/]*[a-z]+)`) - if err != nil { - panic("regexp compile:" + err.Error()) - } + re := regexp.MustCompile(`launchpad\.net[\/:]([^\/]*[a-z]+)`) res := re.FindStringSubmatch(url) if res == nil { |