fix mod command lint errors
Signed-off-by: Tihomir Jovicic <tihomir.jovicic.develop@gmail.com>
This commit is contained in:
parent
c7653dc09c
commit
29ddcca32e
@ -8,11 +8,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func parseArgument(arg string) (*require, error) {
|
func parseArgument(arg string) (*require, error) {
|
||||||
if strings.HasPrefix(arg, "github.com") {
|
switch {
|
||||||
|
case strings.HasPrefix(arg, "github.com"):
|
||||||
return parseGithubRepoName(arg)
|
return parseGithubRepoName(arg)
|
||||||
} else if strings.HasPrefix(arg, "alpha.dagger.io") {
|
case strings.HasPrefix(arg, "alpha.dagger.io"):
|
||||||
return parseDaggerRepoName(arg)
|
return parseDaggerRepoName(arg)
|
||||||
} else {
|
default:
|
||||||
return nil, fmt.Errorf("repo name does not match suported providers")
|
return nil, fmt.Errorf("repo name does not match suported providers")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,7 @@ func read(f io.Reader) (*file, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
lines, err := nonEmptyLines(b)
|
lines := nonEmptyLines(b)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(lines) == 0 {
|
if len(lines) == 0 {
|
||||||
return nil, fmt.Errorf("mod file is empty, missing module name")
|
return nil, fmt.Errorf("mod file is empty, missing module name")
|
||||||
@ -77,7 +74,7 @@ func read(f io.Reader) (*file, error) {
|
|||||||
|
|
||||||
var spaceRgx = regexp.MustCompile(`\s+`)
|
var spaceRgx = regexp.MustCompile(`\s+`)
|
||||||
|
|
||||||
func nonEmptyLines(b []byte) ([]string, error) {
|
func nonEmptyLines(b []byte) []string {
|
||||||
s := strings.ReplaceAll(string(b), "\r\n", "\n")
|
s := strings.ReplaceAll(string(b), "\r\n", "\n")
|
||||||
split := strings.Split(s, "\n")
|
split := strings.Split(s, "\n")
|
||||||
|
|
||||||
@ -93,7 +90,7 @@ func nonEmptyLines(b []byte) ([]string, error) {
|
|||||||
lines = append(lines, trimmed)
|
lines = append(lines, trimmed)
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines, nil
|
return lines
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeModFile(workspacePath string, f *file) error {
|
func writeModFile(workspacePath string, f *file) error {
|
||||||
|
Reference in New Issue
Block a user