Verified Commit 63151dd8 authored by AtjonTV's avatar AtjonTV
Browse files

Corrected some weird code that seemed to misbehave

parent 1d533fca
......@@ -11,7 +11,7 @@ go get gitlab.atvg-studios.com/atvg-studios/go-database
Use `go.mod`
```
require gitlab.atvg-studios.com/atvg-studios/go-database v2.0.0
require gitlab.atvg-studios.com/atvg-studios/go-database v2.0.1
```
# Using
......@@ -55,6 +55,11 @@ func main() {
# Changes
## [2.0.1] (11th Dec 2019)
### Changed
* `Database.ToString` - Corrected some weird code that seemed to misbehave
## [2.0.0] (12th Sep 2019)
### Added
......
......@@ -92,17 +92,20 @@ func (db Database) ToString() (string, error) {
str.WriteString("[")
var i int
var blob []byte
for j := 0; j < len(data); j++ {
for i, blob = range data {
if i < len(data[j]) {
str.Write(blob)
str.WriteString(",")
} else {
str.Write(blob)
}
lastIndex := len(data) -1
var index int
// Go over each element of the data
for index, blob = range data {
// Check if the current Index is smaller then the last index of the data
if index < lastIndex {
// When the index smaller is, write the Blob and a comma
str.Write(blob)
str.WriteString(",")
} else {
// Else just write the Blob
str.Write(blob)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment