mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-17 00:04:31 +02:00
Linter fixes (error handling, unused constants, raw strings)
This commit is contained in:
@@ -595,7 +595,7 @@ func CreateDownloadSession(mods []*Mod, hashesToObtain []string) (DownloadSessio
|
||||
|
||||
// Get necessary metadata for all files
|
||||
for _, mod := range mods {
|
||||
if mod.Download.Mode == "url" || mod.Download.Mode == "" {
|
||||
if mod.Download.Mode == ModeURL || mod.Download.Mode == "" {
|
||||
downloadSession.downloadTasks = append(downloadSession.downloadTasks, downloadTask{
|
||||
mod: mod,
|
||||
url: mod.Download.URL,
|
||||
|
@@ -208,9 +208,8 @@ func (in *Index) Refresh() error {
|
||||
pathIndex, _ := filepath.Abs(in.indexFile)
|
||||
|
||||
packRoot := in.GetPackRoot()
|
||||
ignoreExists := true
|
||||
pathIgnore, _ := filepath.Abs(filepath.Join(packRoot, ".packwizignore"))
|
||||
ignore, ignoreExists := readGitignore(filepath.Join(packRoot, ".packwizignore"))
|
||||
ignore, ignoreExists := readGitignore(pathIgnore)
|
||||
|
||||
var fileList []string
|
||||
err := filepath.Walk(packRoot, func(path string, info os.FileInfo, err error) error {
|
||||
|
14
core/mod.go
14
core/mod.go
@@ -25,8 +25,8 @@ type Mod struct {
|
||||
}
|
||||
|
||||
const (
|
||||
modeURL string = "url"
|
||||
modeCF string = "metadata:curseforge"
|
||||
ModeURL string = "url"
|
||||
ModeCF string = "metadata:curseforge"
|
||||
)
|
||||
|
||||
// ModDownload specifies how to download the mod file
|
||||
@@ -132,11 +132,11 @@ func (m Mod) GetDestFilePath() string {
|
||||
return filepath.Join(filepath.Dir(m.metaFile), filepath.FromSlash(m.FileName))
|
||||
}
|
||||
|
||||
var slugifyRegex1 = regexp.MustCompile("\\(.*\\)")
|
||||
var slugifyRegex2 = regexp.MustCompile(" - .+")
|
||||
var slugifyRegex3 = regexp.MustCompile("[^a-z\\d]")
|
||||
var slugifyRegex4 = regexp.MustCompile("-+")
|
||||
var slugifyRegex5 = regexp.MustCompile("^-|-$")
|
||||
var slugifyRegex1 = regexp.MustCompile(`\(.*\)`)
|
||||
var slugifyRegex2 = regexp.MustCompile(` - .+`)
|
||||
var slugifyRegex3 = regexp.MustCompile(`[^a-z\d]`)
|
||||
var slugifyRegex4 = regexp.MustCompile(`-+`)
|
||||
var slugifyRegex5 = regexp.MustCompile(`^-|-$`)
|
||||
|
||||
func SlugifyName(name string) string {
|
||||
lower := strings.ToLower(name)
|
||||
|
Reference in New Issue
Block a user