Closed orlade-anz closed 4 years ago
An apparent fix is to change syntax/compile.go from
rel.NewString([]rune(path.Join(pc.SourceDir, filepath))),
to
rel.NewString([]rune(filepath)),
This works for arrai run
but may well break arrai eval
. TBC.
... not only is the //{/...}
module import dodgy, it also somehow pollutes the context of subsequent imports. In cases where a module import does work, a subsequent relative //{./...}
import will fail, searching in the module root instead of relative to the script or to working directory.
Please do not post any internal, closed source snippets on this public issue tracker!
Description
//{/path/to/foo}
is supposed to importfoo.arrai
from the pathpath/to/foo.arrai
relative to the root of the module (i.e. thego.mod
file). However it appears to be evaling relative to the current directory.Steps to Reproduce
echo "1" > path/to/bar.arrai
echo "//{/path/to/bar}" > path/to/foo.arrai
arrai run path/to/foo.arrai
Expected behavior
1
Actual behavior
The import
//{/path/to/bar}
is being parsed/interpreted aspath/to/path/to/bar
. Thepath/to/
prefix of thearrai run
command is somehow prepended to the string in the//{/...}
import statement.This doesn't happen for
//{./...}
imports.Your Environment