Commits

Anonymous committed 2ebb3f5

minor fixes for 12.22.2011 weekly

  • Participants
  • Parent commits 94bdfe0

Comments (0)

Files changed (2)

File file_test.go

 
 import (
 	"fmt"
-	"os"
 	"testing"
 )
 
 	file string
 	root string
 	libs string
-	err string
+	err  string
 }
 
 var lddTests = []lddTest{
 func TestLdd(t *testing.T) {
 
 	for _, tt := range lddTests {
-		var _ os.Error
+		var _ error
 		res, _ := Lddroot(tt.file, tt.root, tt.libs)
 		fmt.Printf("Test: '%v' '%v' '%v' '%v' = '%v'\n", tt.file, tt.root, tt.libs, tt.err, res)
 		/*
-		if err != nil {
-			t.Errorf("Test: '%v' '%v' '%v' '%v' = '%v': FAIL\n", tt.file, tt.root, tt.libs, tt.err, res)
-		}
-		 */
+			if err != nil {
+				t.Errorf("Test: '%v' '%v' '%v' '%v' = '%v': FAIL\n", tt.file, tt.root, tt.libs, tt.err, res)
+			}
+		*/
 	}
 }
 // the SunOS/Solaris/Linux ldd command. The root parameter is used
 // on systems which contain a full root file system (e.g. ARM file
 // system on OSX). 
-func Lddroot(cmd, root, liblist string) ([]string, os.Error) {
+func Lddroot(cmd, root, liblist string) ([]string, error) {
 	/* it might just be static ... */
 	ret := []string{}
 	libpath := strings.Split(liblist, ":")
 			libdir = ""
 			e, err = elf.Open(binpath)
 		} else {
-			for _, libdir = range(libpath) {
+			for _, libdir = range libpath {
 				binpath = path.Join(root, libdir, lib)
 				e, err = elf.Open(binpath)
 				if err == nil {
 		/* maybe we should make the chan a []string 
 		 * but I really like chans
 		 */
-		for _, val := range(dynlibs) {
+		for _, val := range dynlibs {
 			strings <- val
 		}
 
 			linkname, err := os.Readlink(binpath)
 			if err != nil {
 				break
-			} 
-			
+			}
+
 			/* NEVER normalize the value you return
 			 * to the caller
 			 * ALWAYS normalize the binpath
 			binpath = path.Join(root, libdir, linkname)
 			known[linkname] = binpath
 		}
-			
+
 	}
 	return ret, nil
 }
 // Ldd returns a []string containing all the files (including 
 // symbolic links) that the binary depends on. It is like 
 // the SunOS/Solaris/Linux ldd command. 
-func Ldd(cmd, liblist string) ([]string, os.Error) {
+func Ldd(cmd, liblist string) ([]string, error) {
 	return Lddroot(cmd, "/", liblist)
 }