Browse Source

Fixed Issue #3 - Go does not goinstall under golang r59

Geoffrey J. Teale 14 năm trước cách đây
mục cha
commit
ed1920a6a4
1 tập tin đã thay đổi với 23 bổ sung24 xóa
  1. 23 24
      lib.go

+ 23 - 24
lib.go

@@ -54,9 +54,9 @@ type Sheet struct {
 // File is a high level structure providing a slice of Sheet structs
 // File is a high level structure providing a slice of Sheet structs
 // to the user.
 // to the user.
 type File struct {
 type File struct {
-	worksheets map[string] *zip.File
+	worksheets     map[string]*zip.File
 	referenceTable []string
 	referenceTable []string
-	Sheets []*Sheet
+	Sheets         []*Sheet
 }
 }
 
 
 
 
@@ -65,7 +65,7 @@ type File struct {
 // the range string "1:3" yield the upper and lower intergers 1 and 3.
 // the range string "1:3" yield the upper and lower intergers 1 and 3.
 func getRangeFromString(rangeString string) (lower int, upper int, error os.Error) {
 func getRangeFromString(rangeString string) (lower int, upper int, error os.Error) {
 	var parts []string
 	var parts []string
-	parts = strings.Split(rangeString, ":", 2);
+	parts = strings.SplitN(rangeString, ":", 2)
 	if parts[0] == "" {
 	if parts[0] == "" {
 		error = os.NewError(fmt.Sprintf("Invalid range '%s'\n", rangeString))
 		error = os.NewError(fmt.Sprintf("Invalid range '%s'\n", rangeString))
 	}
 	}
@@ -102,30 +102,30 @@ func positionalLetterMultiplier(extent, pos int) int {
 // lettersToNumeric is used to convert a character based column
 // lettersToNumeric is used to convert a character based column
 // reference to a zero based numeric column identifier.
 // reference to a zero based numeric column identifier.
 func lettersToNumeric(letters string) int {
 func lettersToNumeric(letters string) int {
-	var sum int = 0 
+	var sum int = 0
 	var shift int
 	var shift int
 	extent := len(letters)
 	extent := len(letters)
 	for i, c := range letters {
 	for i, c := range letters {
 		// Just to make life akward.  If we think of this base
 		// Just to make life akward.  If we think of this base
-                // 26 notation as being like HEX or binary we hit a
-                // nasty little problem.  The issue is that we have no
-                // 0s and therefore A can be both a 1 and a 0.  The
-                // value range of a letter is different in the most
-                // significant position if (and only if) there is more
-                // than one positions.  For example: 
+		// 26 notation as being like HEX or binary we hit a
+		// nasty little problem.  The issue is that we have no
+		// 0s and therefore A can be both a 1 and a 0.  The
+		// value range of a letter is different in the most
+		// significant position if (and only if) there is more
+		// than one positions.  For example: 
 		// "A" = 0 
 		// "A" = 0 
 		//               676 | 26 | 0
 		//               676 | 26 | 0
 		//               ----+----+----
 		//               ----+----+----
-                //                 0 |  0 | 0
+		//                 0 |  0 | 0
 		// 
 		// 
-                //  "Z" = 25
-                //                676 | 26 | 0
-                //                ----+----+----
-                //                  0 |  0 |  25
-                //   "AA" = 26
-                //                676 | 26 | 0
-                //                ----+----+----
-                //                  0 |  1 | 0     <--- note here - the value of "A" maps to both 1 and 0.  
+		//  "Z" = 25
+		//                676 | 26 | 0
+		//                ----+----+----
+		//                  0 |  0 |  25
+		//   "AA" = 26
+		//                676 | 26 | 0
+		//                ----+----+----
+		//                  0 |  1 | 0     <--- note here - the value of "A" maps to both 1 and 0.  
 		if i == 0 && extent > 1 {
 		if i == 0 && extent > 1 {
 			shift = 1
 			shift = 1
 		} else {
 		} else {
@@ -175,7 +175,7 @@ func getCoordsFromCellIDString(cellIDString string) (x, y int, error os.Error) {
 	if error != nil {
 	if error != nil {
 		return x, y, error
 		return x, y, error
 	}
 	}
-	y-=1 // Zero based
+	y -= 1 // Zero based
 	x = lettersToNumeric(letterPart)
 	x = lettersToNumeric(letterPart)
 	return x, y, error
 	return x, y, error
 }
 }
@@ -227,7 +227,7 @@ func readRowsFromSheet(worksheet *XLSXWorksheet, reftable []string) []*Row {
 				} else {
 				} else {
 					cell.data = vval
 					cell.data = vval
 				}
 				}
-				
+
 			}
 			}
 			row.Cells[x] = cell
 			row.Cells[x] = cell
 		}
 		}
@@ -267,7 +267,6 @@ func readSheetsFromZipFile(f *zip.File, file *File) ([]*Sheet, os.Error) {
 }
 }
 
 
 
 
-
 // readSharedStringsFromZipFile() is an internal helper function to
 // readSharedStringsFromZipFile() is an internal helper function to
 // extract a reference table from the sharedStrings.xml file within
 // extract a reference table from the sharedStrings.xml file within
 // the XLSX zip file.
 // the XLSX zip file.
@@ -315,7 +314,7 @@ func OpenFile(filename string) (x *File, e os.Error) {
 		default:
 		default:
 			if len(v.Name) > 12 {
 			if len(v.Name) > 12 {
 				if v.Name[0:13] == "xl/worksheets" {
 				if v.Name[0:13] == "xl/worksheets" {
-					worksheets[v.Name[14:len(v.Name)-4]]= v
+					worksheets[v.Name[14:len(v.Name)-4]] = v
 				}
 				}
 			}
 			}
 		}
 		}
@@ -337,7 +336,7 @@ func OpenFile(filename string) (x *File, e os.Error) {
 	}
 	}
 	if sheets == nil {
 	if sheets == nil {
 		error := new(XLSXReaderError)
 		error := new(XLSXReaderError)
-				error.Error = "No sheets found in XLSX File"
+		error.Error = "No sheets found in XLSX File"
 		return nil, error
 		return nil, error
 	}
 	}
 	file.Sheets = sheets
 	file.Sheets = sheets