mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-30 14:55:52 +00:00
Per the standing fork rule, a hanzoai fork declares its OWN module path and
is required directly -- never resolved via a `replace` against the upstream
path. Keeping the upstream path meant every import line in every consumer
carried the upstream brand.
module github.com/traefik/yaegi -> module github.com/hanzoai/yaegi
Mechanical and behaviour-neutral: every occurrence is an import path
(package self-imports, cmd/, _test/ fixtures interpreted at test time, and
the guthib.com/<org>/{fromage,cheese,vin} fake vendor trees under
example/pkg, whose directory components were renamed in lockstep with the
import strings that reference them).
GOPATH-mode source-import tests (interp TestFile) resolve the module by its
path under $GOPATH/src, so the required checkout location moves with the
module path -- as README already documents. Verified green at
$GOPATH/src/github.com/hanzoai/yaegi.
LICENSE is untouched: "Copyright 2020 Traefik Labs SAS" is the Apache-2.0
attribution and is a legal obligation, not a brand leak.
Also drops the inherited CONTRIBUTING.md CLA clause, which named an
upstream agreement this fork does not administer.
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
// Package unrestricted provides the original version of standard library symbols which may cause the interpreter process to exit.
|
|
package unrestricted
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/exec"
|
|
"reflect"
|
|
)
|
|
|
|
// Symbols stores the map of syscall package symbols.
|
|
var Symbols = map[string]map[string]reflect.Value{}
|
|
|
|
func init() {
|
|
Symbols["os/os"] = map[string]reflect.Value{
|
|
"Exit": reflect.ValueOf(os.Exit),
|
|
"FindProcess": reflect.ValueOf(os.FindProcess),
|
|
}
|
|
|
|
Symbols["os/exec/exec"] = map[string]reflect.Value{
|
|
"Command": reflect.ValueOf(exec.Command),
|
|
"CommandContext": reflect.ValueOf(exec.CommandContext),
|
|
"ErrNotFound": reflect.ValueOf(&exec.ErrNotFound).Elem(),
|
|
"LookPath": reflect.ValueOf(exec.LookPath),
|
|
"Cmd": reflect.ValueOf((*exec.Cmd)(nil)),
|
|
"Error": reflect.ValueOf((*exec.Error)(nil)),
|
|
"ExitError": reflect.ValueOf((*exec.ExitError)(nil)),
|
|
}
|
|
|
|
Symbols["log/log"] = map[string]reflect.Value{
|
|
"Fatal": reflect.ValueOf(log.Fatal),
|
|
"Fatalf": reflect.ValueOf(log.Fatalf),
|
|
"Fatalln": reflect.ValueOf(log.Fatalln),
|
|
"New": reflect.ValueOf(log.New),
|
|
"Logger": reflect.ValueOf((*log.Logger)(nil)),
|
|
}
|
|
|
|
Symbols["github.com/hanzoai/yaegi/stdlib/unrestricted/unrestricted"] = map[string]reflect.Value{
|
|
"Symbols": reflect.ValueOf(Symbols),
|
|
}
|
|
}
|
|
|
|
//go:generate ../../internal/cmd/extract/extract -include=^Exec,Exit,ForkExec,Kill,Ptrace,Reboot,Shutdown,StartProcess,Syscall syscall
|