Summary
Replace runtime file I/O with Go's embed directive to bundle security_events.yaml at compile time. This eliminates the fragile runtime.Caller(0) path resolution that breaks when the module is consumed as a dependency.
Note: This overlaps with issue #4 (Go fixes). If #4 is implemented first with embed, this issue can be closed. If #4 fixes only the ioutil deprecation, this issue covers the embed migration.
Instructions
- Copy
security_events.yaml into the golang/ directory
- Add embed directive to
golang/security_event_logger.go:
import "embed"
//go:embed security_events.yaml
var defaultEventsYAML []byte
- Update
NewSecurityEventLogger to use embedded YAML when no file path is provided
- Keep the explicit file path option for users who want custom event definitions
- Add
golang/security_events.yaml to the CI release workflow copy step
Verification
go build ./... succeeds
go test ./... passes with embedded YAML
- Module works when consumed as a dependency via
go get
Summary
Replace runtime file I/O with Go's
embeddirective to bundlesecurity_events.yamlat compile time. This eliminates the fragileruntime.Caller(0)path resolution that breaks when the module is consumed as a dependency.Note: This overlaps with issue #4 (Go fixes). If #4 is implemented first with embed, this issue can be closed. If #4 fixes only the ioutil deprecation, this issue covers the embed migration.
Instructions
security_events.yamlinto thegolang/directorygolang/security_event_logger.go:NewSecurityEventLoggerto use embedded YAML when no file path is providedgolang/security_events.yamlto the CI release workflow copy stepVerification
go build ./...succeedsgo test ./...passes with embedded YAMLgo get