Comments (12)
Except Windows, which platform did you compile the magpie source?
If you compile it using linux, then maybe you should change the run.sh
file.
14 echo "Building REPL...(magpie)"
15 go build -o magpie main.go
to
14 echo "Building REPL...(magpie)"
15 GOOS=linux go build -o magpie main.go
from magpie.
My OS:
GOOS=darwin
GOARCH=amd64
go env:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tomdean/Library/Caches/go-build"
GOENV="/Users/tomdean/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tomdean/magpie"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
OS: macOS 10.13.6
Platform: amd64
Golang: go version go1.14.3 darwin/amd64
Previos versions of magpie compiled suceessfully, but after last commit, compilation failed.
from magpie.
Then, you should change run.sh
as below:
14 echo "Building REPL...(magpie)"
15 GOOS=darwin go build -o magpie main.go
from magpie.
I know the problem, tomorrow I'll commit a new version and fix the problem.
If you need to use it now, You can add below methods to input_darwin.go
and input_linux.go
func isInwinConsole() bool {
return false
}
func getConsoleTextAttr() int16 {
return 0
}
func setConsoleTextAttr(attr uint16) (n int, err error) {
return 0, nil
}
My home machine's OS is windows, so I cannot test it. Tomorrow, I'll check it at my office.
from magpie.
Then, you should change
run.sh
as below:14 echo "Building REPL...(magpie)" 15 GOOS=darwin go build -o magpie main.go
@haifenghuang Same error.
from magpie.
I know the problem, tomorrow I'll commit a new version and fix the problem.
@haifenghuang Ok.
from magpie.
I know the problem, tomorrow I'll commit a new version and fix the problem.
If you need to use it now, You can add below methods to
input_darwin.go
andinput_linux.go
func isInwinConsole() bool { return false } func getConsoleTextAttr() int16 { return 0 } func setConsoleTextAttr(attr uint16) (n int, err error) { return 0, nil }
My home machine's OS is windows, so I cannot test it. Tomorrow, I'll check it at my office.
After adding this piece of code I got the following error:
Building REPL...(magpie)
# magpie/repl
src/magpie/repl/repl.go:75:16: l.IsInwinConsole undefined (type *liner.State has no field or method IsInwinConsole)
from magpie.
I understood, also you should to add:
func (s *State) IsInwinConsole() bool {
return isInwinConsole()
}
this is shortcut for isInwinConsole()
Now everything compiled, but highlighting does not works on Linux/Darwin:
from magpie.
Hi, I made a mistake. Just change source from:
if h.isWinConsole {
colorsMap = map[Color]string{
COLOR_BLACK: "\x1b[30m",
COLOR_BLUE: "\x1b[34m",
COLOR_GREEN: "\x1b[32m",
COLOR_CYAN: "\x1b[36m",
COLOR_RED: "\x1b[31m",
COLOR_MAGENTA: "\x1b[35m",
COLOR_YELLOW: "\x1b[33m",
COLOR_WHITE: "\x1b[37m",
}
h.textAttr = getConsoleTextAttr()
}
to
if h.isWinConsole {
h.textAttr = getConsoleTextAttr()
} else {
colorsMap = map[Color]string{
COLOR_BLACK: "\x1b[30m",
COLOR_BLUE: "\x1b[34m",
COLOR_GREEN: "\x1b[32m",
COLOR_CYAN: "\x1b[36m",
COLOR_RED: "\x1b[31m",
COLOR_MAGENTA: "\x1b[35m",
COLOR_YELLOW: "\x1b[33m",
COLOR_WHITE: "\x1b[37m",
}
}
from magpie.
As for
func (s *State) IsInwinConsole() bool {
return isInwinConsole()
}
Since we added isInwinConsole
, getConsoleTextAttr
and setConsoleTextAttr
to input_darwin.go
and input_linux.go
, so I think we should remove above code from input_windows.go
and add it to line.go
.
from magpie.
Hi, I just committed a new version, and tested on windows
, Linux
and Ubuntu
, now it works fine for these platforms.
from magpie.
@haifenghuang Everything works on macOS too.
from magpie.
Related Issues (17)
- hash vivification not working HOT 15
- Question: have you planned to make Magpie compilable or bytecode? HOT 2
- Question: When do you want to implement interface, public, private, protected keywords? HOT 1
- [REPL Bug] stdin does not scans full string. HOT 1
- [REPL Bug] include errors ignoring. HOT 1
- How to check the typeof obj ? HOT 2
- Could Break to Label? HOT 1
- Is there go-routine feature? HOT 1
- howto get properties from json object HOT 2
- Hello HOT 1
- tcp的read方法阻塞 HOT 1
- idea: add namespace management HOT 6
- Please add multiline code blocks to the REPL. HOT 5
- Errors in tests. HOT 4
- I found a way to add support for highlight on Windows HOT 2
- Question: let keyword HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magpie.