diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-23 14:23:34 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-23 14:23:34 +0100 |
commit | dc21ad089295723ca95bf1b452d2f6f31c51c735 (patch) | |
tree | 396df7da8fc1fbcb8d4edd289c09bfe933c04c68 /bridge/core/bridge.go | |
parent | b3318335986618388637a9d35d68b39633e4548a (diff) | |
download | git-bug-dc21ad089295723ca95bf1b452d2f6f31c51c735.tar.gz |
use regex.MustCompile instead of dealing with the error
Diffstat (limited to 'bridge/core/bridge.go')
-rw-r--r-- | bridge/core/bridge.go | 10 |
1 files changed, 2 insertions, 8 deletions
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) |