Refactor unsafe pointer usage to use reflect.Type and pointers

Remove internal/danger package and replace unsafe pointer arithmetic with direct pointer manipulation. Update AST node references to use pointers instead of integer offsets. This improves code safety and maintainability.

Co-authored-by: thomas.pelletier <thomas.pelletier@bedrockrobotics.com>
This commit is contained in:
Cursor Agent
2026-01-04 03:11:48 +00:00
parent 9702fae9b8
commit f09f77ab06
10 changed files with 44 additions and 306 deletions
+1 -2
View File
@@ -5,7 +5,6 @@ import (
"strconv"
"strings"
"github.com/pelletier/go-toml/v2/internal/danger"
"github.com/pelletier/go-toml/v2/unstable"
)
@@ -99,7 +98,7 @@ func (e *DecodeError) Key() Key {
//
//nolint:funlen
func wrapDecodeError(document []byte, de *unstable.ParserError) *DecodeError {
offset := danger.SubsliceOffset(document, de.Highlight)
offset := cap(document) - cap(de.Highlight)
errMessage := de.Error()
errLine, errColumn := positionAtEnd(document[:offset])