We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__FILE__
Please answer these questions before submitting your issue. Thanks!
go version
go version go1.8.3 darwin/amd64
go env
GOARCH="amd64" GOBIN="/Users/401208/bin" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/401208" GORACE="" GOROOT="/usr/local/opt/go/libexec" GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9q/wtg2gqwd57x88fy6qw79klsn6zl9w9/T/go-build854393630=/tmp/go-build -gno-record-gcc-switches -fno-common" CXX="clang++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
git show -s --format=%H # => 07b0c0a9b40cc6551c20cc830965e315ab61c803
cat <<EOF > /tmp/foo > puts __FILE__ > EOF go run main.go /tmp/foo
/tmp/foo
undefined local variable or method `__FILE__' for main:Object exit status 1
The text was updated successfully, but these errors were encountered:
This is an interesting bug, with the current repository:
$ git show -s --format=%H ee5b7274d84c124a2bd3b3d6f1e2c78d31148cc5
There have obviously been changes now, such that __FILE__ is defined. The following code works:
frodo ~/go/src/github.com/goruby/goruby $ cat > t.rb <<EOF > puts( __FILE__ ) > EOF frodo ~/go/src/github.com/goruby/goruby $ ./goruby t.rb t.rb
However this code fails:
puts __FILE__
(Outputs an empty line.)
I've updated kernel.go:
kernel.go
func kernelPuts(context CallContext, args ...RubyObject) (RubyObject, error) { out := "" fmt.Printf("Argument count %d\n", len(args)) for i, arg := range args { fmt.Printf("Arg %i: %v\n", i, arg) out += arg.Inspect() } fmt.Println(out) return NIL, nil }
Now the sample program that works outputs things you'd expect:
$ cat tt.rb puts( __FILE__ ) $ go build . && ./goruby tt.rb Argument count 1 Arg %!i(int=0): &{tt.rb} tt.rb
But the version without the parenthesis receives nothing:
$ cat t.rb puts __FILE__ $ go build . && ./goruby t.rb Argument count 0
So something odd is going on there :)
Sorry, something went wrong.
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8.3 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What version of GoRuby are you using (git show -s --format=%H or goruby -version)?
git show -s --format=%H # => 07b0c0a9b40cc6551c20cc830965e315ab61c803
What did you do?
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: