Commits

Anonymous committed 2dfe39d

applied go1rename

Comments (0)

Files changed (1)

 import (
 	"archive/tar"
 	"compress/gzip"
-	"gob"
+	"encoding/gob"
+	"errors"
 	"io"
 	//"json"
 	"os"
 	tuples map[string]*Tuple
 }
 
-func Create(fname string) (*File, os.Error) {
+func Create(fname string) (*File, error) {
 	dir_root := filepath.Join(_HEPIO_ROOT, fname)
 	err := os.RemoveAll(dir_root)
 	if err != nil {
 	return hepfile, nil
 }
 
-func Open(fname string) (*File, os.Error) {
+func Open(fname string) (*File, error) {
 	dir_root := filepath.Join(_HEPIO_ROOT, fname)
 	err := os.RemoveAll(dir_root)
 	if err != nil {
 	// FIXME: make this lazy...
 	for {
 		hdr, err := tr.Next()
-		if err == os.EOF {
+		if err == io.EOF {
 			// end of tar archive
 			break
 		}
 }
 
 // Create a new Tuple in folder name 
-func (f *File) CreateTuple(name string) (*Tuple, os.Error) {
+func (f *File) CreateTuple(name string) (*Tuple, error) {
 	ff, err := os.Create(filepath.Join(f.dir, name))
 	if err != nil {
 		return nil, err
 	return f.tuples[name], nil
 }
 
-func (f *File) OpenTuple(name string) (*Tuple, os.Error) {
+func (f *File) OpenTuple(name string) (*Tuple, error) {
 	ff, err := os.Open(filepath.Join(f.dir, name))
 	if err != nil {
 		return nil, err
 	return v
 }
 
-func (f *File) Close() os.Error {
+func (f *File) Close() error {
 	metadata := make(map[string]metadata)
 	for n, t := range f.tuples {
 		//println("-- closing:",t.f.Name())
 		err := t.Close()
 		if err != nil {
-			return os.NewError("problem closing [" + n + "]: " + err.String())
+			return errors.New("problem closing [" + n + "]: " + err.Error())
 		}
 		metadata[n] = make_metadata_from(t)
 	}
 	if err != nil {
 		return err
 	}
-	tarfile := func(fd *os.File) os.Error {
+	tarfile := func(fd *os.File) error {
 		fd.Sync()
 		tuple, err := os.Open(fd.Name())
 		if err != nil {
-			println(err.String())
+			println(err.Error())
 			return err
 		}
 		stats, err := tuple.Stat()
 	nentries int64
 }
 
-func (t *Tuple) Write(v interface{}) os.Error {
+func (t *Tuple) Write(v interface{}) error {
 	err := t.w.enc.Encode(v)
 	if err == nil {
 		t.nentries += 1
 	return err
 }
 
-func (t *Tuple) Close() os.Error {
+func (t *Tuple) Close() error {
 	//println("... closing ["+t.f.Name()+"] ...")
-	var err os.Error = nil
+	var err error = nil
 	if t.w != nil {
 		err = t.w.compr.Close()
 		if err != nil {
 	return t.nentries
 }
 
-func (t *Tuple) Read(v interface{}) os.Error {
+func (t *Tuple) Read(v interface{}) error {
 	err := t.r.dec.Decode(v)
 	return err
 }