Skip to content

Commit

Permalink
вынес регулярку в переменные модуля
Browse files Browse the repository at this point in the history
  • Loading branch information
thedemoncat committed Mar 15, 2021
1 parent e2d045e commit 0898988
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unpacker/unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"log"
"regexp"
)

type Unpacker struct {
Logger *log.Logger
}

var re = regexp.MustCompile(`^1c-enterprise[\d]*-[\d\.\d\.\d*\.\d*]*-*([a-z-]*)_([\d\.\d\.\d*\.\d*-]*)_(amd64)\.([a-z]*)$`)

func New(config *Unpacker) *Unpacker {
return config
}
Expand All @@ -23,7 +24,6 @@ func (u *Unpacker) Extract(filename string, destinatin string) error {
}

func (u *Unpacker) GetAliasesDistrib(fileName string) string {
regexp := regexp.MustCompile(`^1c-enterprise[\d]*-[\d\.\d\.\d*\.\d*]*-*([a-z-]*)_([\d\.\d\.\d*\.\d*-]*)_(amd64)\.([a-z]*)$`)
resultFileName := regexp.ReplaceAllString(fileName, `$1-$2.$4`)
resultFileName := re.ReplaceAllString(fileName, `$1-$2.$4`)
return resultFileName
}

0 comments on commit 0898988

Please sign in to comment.