Commits

Fazlul Shahriar committed ca3bf54

Go 1 fixes

  • Participants
  • Parent commits 0fe8295

Comments (0)

Files changed (2)

 import (
 	"bufio"
 	"bytes"
+	"errors"
 	"fmt"
 	"io"
 	"os"
 	return b[:n], b[n:]
 }
 
-func Open(filename string) (*File, os.Error) {
+func Open(filename string) (*File, error) {
 	fd, err := os.Open(filename)
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	if bytes.Compare(magic, hdfMagic) != 0 {
-		return nil, os.NewError("not a HDF file")
+		return nil, errors.New("not a HDF file")
 	}
 	if err = file.readDescriptors(); err != nil {
 		return nil, err
 	file.fd.Close()
 }
 
-func (file *File) readDescriptors() os.Error {
+func (file *File) readDescriptors() error {
 	file.Records = nil
 	for {
 		// Read block header
 // LookupRecord returns the first record matching tag
 // and ref, which uniquely identifies a record. If ref < 0,
 // first record matching tag is returns.
-func (file *File) LookupRecord(tag, ref int) (*Record, os.Error) {
+func (file *File) LookupRecord(tag, ref int) (*Record, error) {
 	var rec *Record
 	for i := 0; i < len(file.Records); i++ {
 		rec = &file.Records[i]
 			goto found
 		}
 	}
-	return nil, os.NewError("tag/ref not found")
+	return nil, errors.New("tag/ref not found")
 
 found:
 	if rec.Info == nil && !rec.parsing {
 	return rec, nil
 }
 
-func (file *File) lookupNumType(tag, ref int) (*NumType, os.Error) {
+func (file *File) lookupNumType(tag, ref int) (*NumType, error) {
 	rec, err := file.LookupRecord(int(tag), int(ref))
 	if err != nil {
 		return nil, err
 	return nt, nil
 }
 
-func (rec *Record) readPayload() ([]byte, os.Error) {
+func (rec *Record) readPayload() ([]byte, error) {
 	if _, err := rec.file.fd.Seek(int64(rec.offset), os.SEEK_SET); err != nil {
 		return nil, err
 	}
 	ScaleNT []*NumType
 }
 
-func (file *File) parseSDD(b []byte) (*SDD, os.Error) {
+func (file *File) parseSDD(b []byte) (*SDD, error) {
 	sdd := new(SDD)
 	rank, b := get16(b)
 
 	Records []*Record
 }
 
-func (file *File) parseNDG(b []byte) (*NDG, os.Error) {
+func (file *File) parseNDG(b []byte) (*NDG, error) {
 	var tag, ref uint16
 
 	ndg := new(NDG)
 	version      uint16
 }
 
-func (file *File) parseVGroup(b []byte) (*VGroup, os.Error) {
+func (file *File) parseVGroup(b []byte) (*VGroup, error) {
 	vg := new(VGroup)
 	nelt, b := get16(b)
 

hdf4/hdf4_test.go

 	"testing"
 )
 
-const hdfPath = "/home/fhs/glasslab/src/cmd/modis_crefl/tbase.hdf"
+const hdfPath = "/home/fhs/csdirs/src/pkg/cluster/glasslab_cluster/data/modis_crefl_tbase.hdf"
 
 func TestOpen(t *testing.T) {
 	file, err := Open(hdfPath)