update mod list tags tests

Signed-off-by: Tihomir Jovicic <tihomir.jovicic.develop@gmail.com>
This commit is contained in:
Tihomir Jovicic 2021-08-04 08:20:58 +02:00
parent e5c8d6eee0
commit be913b0e90
2 changed files with 5 additions and 1 deletions

View File

@ -66,6 +66,10 @@ func read(f io.Reader) (*file, error) {
return nil, err return nil, err
} }
if len(lines) == 0 {
return nil, fmt.Errorf("mod file is empty")
}
var module string var module string
if split := strings.Split(lines[0], " "); len(split) > 1 { if split := strings.Split(lines[0], " "); len(split) > 1 {
module = strings.Trim(split[1], "\"") module = strings.Trim(split[1], "\"")

View File

@ -66,7 +66,7 @@ func TestListTags(t *testing.T) {
r, err := clone(&require{ r, err := clone(&require{
prefix: "https://", prefix: "https://",
repo: "github.com/cuelang/cue", repo: "github.com/tjovicic/gcpcloudrun-cue",
path: "", path: "",
version: "", version: "",
}, tmpDir) }, tmpDir)