Skip to content

Use Go embed for YAML bundling #13

Description

@thatsjet

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

  1. Copy security_events.yaml into the golang/ directory
  2. Add embed directive to golang/security_event_logger.go:
    import "embed"
    
    //go:embed security_events.yaml
    var defaultEventsYAML []byte
  3. Update NewSecurityEventLogger to use embedded YAML when no file path is provided
  4. Keep the explicit file path option for users who want custom event definitions
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Nice to have — improves adoptionpackagingPackage registry and distribution

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions