stdlib: remove embed wrapper

Embedding files using `//go:embed` and `embed` packages can not be supported in yaegi, so it is better to not generate the wrapper to embed and have a graceful error in case of usage of `embed.FS` in the interpreter.
Also update README about unsuported directives.

Fixes #1557.
This commit is contained in:
Marc Vertes
2023-06-14 19:04:05 +02:00
committed by GitHub
parent 6447a677f3
commit f4a9cd3cbe
4 changed files with 2 additions and 37 deletions

View File

@@ -172,6 +172,7 @@ Beside the known [bugs] which are supposed to be fixed in the short term, there
- Assembly files (`.s`) are not supported.
- Calling C code is not supported (no virtual "C" package).
- Directives about the compiler, the linker, or embedding files are not supported.
- Interfaces to be used from the pre-compiled code can not be added dynamically, as it is required to pre-compile interface wrappers.
- Representation of types by `reflect` and printing values using %T may give different results between compiled mode and interpreted mode.
- Interpreting computation intensive code is likely to remain significantly slower than in compiled mode.

View File

@@ -1,18 +0,0 @@
// Code generated by 'yaegi extract embed'. DO NOT EDIT.
//go:build go1.19 && !go1.20
// +build go1.19,!go1.20
package stdlib
import (
"embed"
"reflect"
)
func init() {
Symbols["embed/embed"] = map[string]reflect.Value{
// type definitions
"FS": reflect.ValueOf((*embed.FS)(nil)),
}
}

View File

@@ -1,18 +0,0 @@
// Code generated by 'yaegi extract embed'. DO NOT EDIT.
//go:build go1.20
// +build go1.20
package stdlib
import (
"embed"
"reflect"
)
func init() {
Symbols["embed/embed"] = map[string]reflect.Value{
// type definitions
"FS": reflect.ValueOf((*embed.FS)(nil)),
}
}

View File

@@ -35,7 +35,7 @@ func init() {
//go:generate ../internal/cmd/extract/extract crypto/subtle crypto/tls crypto/x509 crypto/x509/pkix
//go:generate ../internal/cmd/extract/extract database/sql database/sql/driver
//go:generate ../internal/cmd/extract/extract debug/buildinfo debug/dwarf debug/elf debug/gosym debug/macho debug/pe debug/plan9obj
//go:generate ../internal/cmd/extract/extract embed encoding encoding/ascii85 encoding/asn1 encoding/base32
//go:generate ../internal/cmd/extract/extract encoding encoding/ascii85 encoding/asn1 encoding/base32
//go:generate ../internal/cmd/extract/extract encoding/base64 encoding/binary encoding/csv encoding/gob
//go:generate ../internal/cmd/extract/extract encoding/hex encoding/json encoding/pem encoding/xml
//go:generate ../internal/cmd/extract/extract errors expvar flag fmt