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
@@ -1,7 +1,6 @@
package toml
import (
"github.com/pelletier/go-toml/v2/internal/danger"
"github.com/pelletier/go-toml/v2/internal/tracker"
"github.com/pelletier/go-toml/v2/unstable"
)
@@ -103,5 +102,5 @@ func keyLocation(node *unstable.Node) []byte {
end = k.Node().Data
}
return danger.BytesRange(start, end)
return start[:cap(start)-cap(end)+len(end)]
}