Skip to content

Commit 0668452

Browse files
committed
feat(writer): GLORIOUS WRITER
Signed-off-by: dark0dave <[email protected]>
1 parent dc46139 commit 0668452

File tree

14 files changed

+2230
-534
lines changed

14 files changed

+2230
-534
lines changed

.mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[tools]
22
go = "1.25"
3+
"go:github.com/go-delve/delve/cmd/dlv" = "latest"

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}"
13+
}
14+
]
15+
}

bg/all.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package bg
33
import (
44
"encoding/binary"
55
"encoding/json"
6-
"fmt"
76
"io"
87
"strings"
98
)
@@ -29,12 +28,19 @@ func max(x, y int) int {
2928

3029
type LongString [32]byte
3130

32-
func (r *LongString) String() string {
33-
return string(r[0:])
31+
func (l *LongString) String() string {
32+
return string(l[:])
3433
}
3534

36-
func (r *LongString) MarshalJSON() ([]byte, error) {
37-
return fmt.Appendf(nil, "\\%s\\", r.String()), nil
35+
func (l *LongString) MarshalJSON() ([]byte, error) {
36+
return []byte(l.String()), nil
37+
}
38+
39+
func (l *LongString) UnmarshalJSON(b []byte) error {
40+
for i := range min(len(b)-2, 32) {
41+
l[i] = b[i+1]
42+
}
43+
return nil
3844
}
3945

4046
type Signature [4]byte

0 commit comments

Comments
 (0)