github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/pkg/types/types.go (about) 1 package types 2 3 import ( 4 "strings" 5 ) 6 7 type Alias string 8 9 func (a Alias) String() string { 10 return string(a) 11 } 12 13 func (a Alias) IsEmpty() bool { 14 return len(string(a)) == 0 15 } 16 17 type ImportPath string 18 19 func (p ImportPath) Host() Host { 20 if strings.HasPrefix(string(p), "github.com/") { 21 return HostGithub 22 } 23 return HostUnknown 24 } 25 26 func (p ImportPath) String() string { 27 return string(p) 28 } 29 30 type Host int 31 32 const ( 33 HostUnknown = iota 34 HostGithub 35 )