go:embed cannot embed files larger than 2GB, cannot embed files with names containing backslashes, and cannot embed files from outside the module directory at compile time. Use archive/zip or archive/tar to bundle large or complex file sets at runtime instead of compile time.
import (
"archive/zip"
"io"
"os"
)
func loadLargeAsset(path string) ([]byte, error) {
f, err := os.Open(path)
if err != nil { return nil, err }
defer f.Close()
return io.ReadAll(f)
}