diff --git a/CHANGELOG.md b/CHANGELOG.md index ef6a692..e6986e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - yyyy-mm-dd +## [0.1.12] - 2024-09-22 + +- Fix `consume()` missing null terminator in `StringBuilder`. + ## [0.1.11] - 2024-09-22 - Fix `consume()` missing null terminator. diff --git a/mojoproject.toml b/mojoproject.toml index 457300e..7600fd2 100644 --- a/mojoproject.toml +++ b/mojoproject.toml @@ -4,7 +4,7 @@ channels = ["conda-forge", "https://conda.modular.com/max"] description = "Experiments in porting over Golang stdlib into Mojo." name = "gojo" platforms = ["osx-arm64", "linux-64"] -version = "0.1.11" +version = "0.1.12" [tasks] tests = "bash scripts/tests.sh" diff --git a/src/gojo/strings/builder.mojo b/src/gojo/strings/builder.mojo index 7837f16..cb302ab 100644 --- a/src/gojo/strings/builder.mojo +++ b/src/gojo/strings/builder.mojo @@ -97,7 +97,9 @@ struct StringBuilder[growth_factor: Float32 = 2]( Returns: The string representation of the string builder. Returns an empty string if the buffer is empty. """ - var result = String(self._data, self._size) + var bytes = List[UInt8, True](unsafe_pointer=self._data, size=self._size, capacity=self._capacity) + bytes.append(0) + var result = String(bytes^) self._data = UnsafePointer[UInt8]() self._size = 0 return result diff --git a/src/recipe.yaml b/src/recipe.yaml index c96f88a..9c328a5 100644 --- a/src/recipe.yaml +++ b/src/recipe.yaml @@ -5,7 +5,7 @@ context: package: name: "gojo" - version: 0.1.11 + version: 0.1.12 source: - path: .