// NewSource generates a new source instance from a given path
// and validates the path, computes the file checksum and size.
NewSource generates a new source instance from a given path
and validates the path, computes the file checksum and size.
// NewSource generates a new source instance from a given path // and validates the path computes the file checksum and size .
func NewSource(path string) *Source {
	fi, err := os.Stat(path)
	if err != nil || fi.IsDir() {
		return nil
	}
	checksum, err := utils.Md5Checksum(path)
	if err != nil {
		log.Warn(err)
	}
	return &Source{
		Src:      "",
		Size:     fi.Size(),
		Checksum: checksum,
	}
}
func NewSource ( path string ) * Source { fi , err := os . Stat ( path ) if err != nil || fi . IsDir ( ) { return nil } checksum , err := utils . Md5Checksum ( path ) if err != nil { log . Warn ( err ) } return & Source { Src : " " , Size : fi . Size ( ) , Checksum : checksum , } }
NewSource generates a new source instance from a given path
and validates the path, computes the file checksum and size.
NewSource generates a new source instance from a given path and validates the path computes the file checksum and size .
// TODO: How to deal with error here also