Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
155a7bc17f |
2
main.go
2
main.go
@@ -614,7 +614,7 @@ func stripExts(file string) string {
|
|||||||
if filepath.Ext(file) == "" {
|
if filepath.Ext(file) == "" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
file = strings.Trim(file, filepath.Ext(file))
|
file = strings.TrimSuffix(file, filepath.Ext(file))
|
||||||
}
|
}
|
||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ func TestStripExts(t *testing.T) {
|
|||||||
{"file.tar.gz.xz.zip", "file"},
|
{"file.tar.gz.xz.zip", "file"},
|
||||||
{"another_file", "another_file"},
|
{"another_file", "another_file"},
|
||||||
{"a.b.c.d.e.f.g.h.i", "a"},
|
{"a.b.c.d.e.f.g.h.i", "a"},
|
||||||
|
{"virtio_blk.ko", "virtio_blk"},
|
||||||
}
|
}
|
||||||
for _, table := range tables {
|
for _, table := range tables {
|
||||||
out := stripExts(table.in)
|
out := stripExts(table.in)
|
||||||
|
Reference in New Issue
Block a user