wisski-cloud-distillery/internal/wisski/ingredient/barrel/composer/name.go

14 lines
327 B
Go

package composer
import "strings"
// ModuleName extracts the module name from a specification.
// If the module name cannot be found, returns the string unchanged
func ModuleName(spec string) string {
_, name, found := strings.Cut(spec, "/")
if !found {
return spec
}
name, _, _ = strings.Cut(name, ":")
return name
}