gopherage/pkg/util/util.go
func LoadProfile(origin string) ([]*cover.Profile, error) {
	filename := origin
	if origin == "-" {
		// Annoyingly, ParseProfiles only accepts a filename, so we have to write the bytes to disk
		// so it can read them back.
		// We could probably also just give it /dev/stdin, but that'll break on Windows.
		tf, err := ioutil.TempFile("", "")
		if err != nil {
			return nil, fmt.Errorf("failed to create temp file: %v", err)
		}
		defer tf.Close()
		defer os.Remove(tf.Name())
		if _, err := io.Copy(tf, os.Stdin); err != nil {
			return nil, fmt.Errorf("failed to copy stdin to temp file: %v", err)
		}
		filename = tf.Name()
	}
	return cover.ParseProfiles(filename)
}
func LoadProfile(origin string) ([]*cover.Profile, error) {
	filename := origin
	if origin == "-" {
		// Annoyingly, ParseProfiles only accepts a filename, so we have to write the bytes to disk
		// so it can read them back.
		// We could probably also just give it /dev/stdin, but that'll break on Windows.
		tf, err := ioutil.TempFile("", "")
		if err != nil {
			return nil, fmt.Errorf("failed to create temp file: %v", err)
		}
		defer tf.Close()
		defer os.Remove(tf.Name())
		if _, err := io.Copy(tf, os.Stdin); err != nil {
			return nil, fmt.Errorf("failed to copy stdin to temp file: %v", err)
		}
		filename = tf.Name()
	}
	return cover.ParseProfiles(filename)
}
func LoadProfile ( origin string ) ( [ ] * cover . Profile , error ) { filename := origin if origin == " " { // Annoyingly, ParseProfiles only accepts a filename, so we have to write the bytes to disk // so it can read them back. // We could probably also just give it /dev/stdin, but that'll break on Windows. tf , err := ioutil . TempFile ( " " , " " ) if err != nil { return nil , fmt . Errorf ( " " , err ) } defer tf . Close ( ) defer os . Remove ( tf . Name ( ) ) if _ , err := io . Copy ( tf , os . Stdin ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } filename = tf . Name ( ) } return cover . ParseProfiles ( filename ) }
// LoadProfile loads a profile from the given filename.
// If the filename is "-", it instead reads from stdin.
LoadProfile loads a profile from the given filename . If the filename is - it instead reads from stdin .