Documentation
¶
Index ¶
- Constants
- func ExpandPath(path string) string
- func FileExist(path string) error
- func FullySplitPath(path string) (split []string)
- func GetIssueReportBody(ctx context.Context) string
- func GetRelativePath(absolutePath string) (string, error)
- func GetValidator() *validator.Validate
- func IsWritableFile(path string) bool
- func JSONParse[T any](file []byte) (T, error)
- func JSONSerialize(in any) ([]byte, error)
- func NormalizePathToSlash(p string) string
- func OpenMailClient(to string, subject string, body string) error
- func RemoveProtocolFromURL(url string) string
- func SetValidator(v *validator.Validate)
- func ValidatePurl(fl validator.FieldLevel) bool
- func WriteFile(filename string, data []byte) error
- func WriteJsonFile(path string, in any) error
- type DefaultFileReader
- type FileReader
Constants ¶
const (
SCANOSS_SUPPORT_MAILBOX = "support@scanoss.com"
)
Variables ¶
This section is empty.
Functions ¶
func ExpandPath ¶
func FullySplitPath ¶ added in v0.7.3
fullySplitPath splits a path into ALL its components. The gitignore library expects to be handed a slice of everything busted ALL the way apart, but the core filepath.Split ONLY breaks off the final path component.
We theoretically could split on our platform-native path separator BUT it's not quite that simple: on windows, both forward AND back slashes as path separators, plus there's special handling of potential volume specifiers.
We COULD mimic filepath.Split's implementation stepping through and checking IsPathSeparator(), but to keep it simple, we'll just repeatedly call that directly. These are all short enough it isn't that expensive.
func GetIssueReportBody ¶
func GetRelativePath ¶
func GetValidator ¶
func IsWritableFile ¶
func JSONSerialize ¶
func NormalizePathToSlash ¶ added in v0.7.4
NormalizePathToSlash converts OS-specific separators to `/` and runs `path.Clean` to collapse “…/.” or “…/..” segments. For empty input it returns ".", mimicking `path.Clean`.
func RemoveProtocolFromURL ¶ added in v0.8.0
RemoveProtocolFromURL removes the HTTP or HTTPS protocol prefix from a URL string. If no protocol is found, returns the original string unchanged.
func SetValidator ¶
func ValidatePurl ¶
func ValidatePurl(fl validator.FieldLevel) bool
func WriteJsonFile ¶
Types ¶
type DefaultFileReader ¶
type DefaultFileReader struct{}
func NewDefaultFileReader ¶
func NewDefaultFileReader() *DefaultFileReader