// writeSnapshot creates or updates a Snapshot.
writeSnapshot creates or updates a Snapshot.
// writeSnapshot creates or updates a Snapshot .
func writeSnapshot(id snapshotID, value string, isUpdate bool) (*snapshot, error) {
	if !id.isValid() {
		return nil, errInvalidSnapshotID
	}
	if err := loadSnapshots(); err != nil {
		return nil, err
	}
	dir, err := findOrCreateSnapshotDirectory()
	if err != nil {
		return nil, err
	}
	pkg, err := getTestingPackage()
	if err != nil {
		return nil, err
	}
	path := filepath.Join(dir, fmt.Sprintf("%s%s", pkg, snapshotExt))
	s := &snapshot{
		id:        id,
		value:     value,
		path:      path,
		evaluated: isUpdate,
	}
	allSnapMutex.Lock()
	allSnapshots[id] = s
	allSnapMutex.Unlock()
	err = allSnapshots.save()
	if err != nil {
		return nil, err
	}
	return s, nil
}
func writeSnapshot ( id snapshotID , value string , isUpdate bool ) ( * snapshot , error ) { if ! id . isValid ( ) { return nil , errInvalidSnapshotID } if err := loadSnapshots ( ) ; err != nil { return nil , err } dir , err := findOrCreateSnapshotDirectory ( ) if err != nil { return nil , err } pkg , err := getTestingPackage ( ) if err != nil { return nil , err } path := filepath . Join ( dir , fmt . Sprintf ( " " , pkg , snapshotExt ) ) s := & snapshot { id : id , value : value , path : path , evaluated : isUpdate , } allSnapMutex . Lock ( ) allSnapshots [ id ] = s allSnapMutex . Unlock ( ) err = allSnapshots . save ( ) if err != nil { return nil , err } return s , nil }
writeSnapshot creates or updates a Snapshot.
writeSnapshot creates or updates a Snapshot .