Skip to content
New issue

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

Update for 0.9.8 #18

Merged
merged 9 commits into from
Aug 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ module github.com/goplus/www
go 1.12

require (
cloud.google.com/go v0.58.0
contrib.go.opencensus.io/exporter/prometheus v0.2.0
contrib.go.opencensus.io/exporter/stackdriver v0.13.1
github.com/aws/aws-sdk-go v1.32.5
cloud.google.com/go v0.75.0
contrib.go.opencensus.io/exporter/prometheus v0.3.0
contrib.go.opencensus.io/exporter/stackdriver v0.13.8
github.com/aws/aws-sdk-go v1.37.0
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/google/go-cmp v0.5.0
github.com/qiniu/goplus v0.6.41-0.20200627014401-a031ebddfa3f
github.com/google/go-cmp v0.5.5
github.com/goplus/gop v0.9.8
github.com/shurcooL/webdavfs v0.0.0-20190527155401-0680c3c63e3c
go.opencensus.io v0.22.4
go.opencensus.io v0.23.0
golang.org/x/build v0.0.0-20200618235529-3228d3c70d31
golang.org/x/mod v0.3.0
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f
google.golang.org/api v0.28.0
google.golang.org/genproto v0.0.0-20200619004808-3e7fca5c55db
golang.org/x/mod v0.4.2
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
golang.org/x/tools v0.1.5
google.golang.org/api v0.37.0
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506
google.golang.org/grpc v1.39.0 // indirect
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919
)

Expand Down
258 changes: 258 additions & 0 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion goplus.org/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h2 class="pb-3">Rational number: bigint, bigrat, bigfloat</h2>
For example, (1r << 200) means a big int whose value is equal to 2<sup>200</sup>. And 4/5r means the
rational
constant 4/5.</P>
<a href="https://play.goplus.org/p/bRwN15drYVP">
<a href="https://play.goplus.org/p/032nhvqlltj">
<button type="btn" class="btn btn-info ">Go to Playground</button>
</a>

Expand Down
3 changes: 0 additions & 3 deletions playground/examples/rational.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ b := 4/5r // bigrat
c := b - 1/3r + 3*1/2r
println(a, b, c)

x := 3.14159265358979323846264338327950288419716939937510582097494459r
x *= 2
println(x)
2 changes: 1 addition & 1 deletion playground/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package main
import (
"encoding/json"
"fmt"
"github.com/qiniu/goplus/format"
"github.com/goplus/gop/format"
"net/http"
"path"

Expand Down
5 changes: 2 additions & 3 deletions playground/fmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ func TestHandleFmt(t *testing.T) {
{
name: "goplus hello world",
method: http.MethodPost,
body: `println("Hello, Go+")

body: `println("Hello, Go+")

println(1r << 129 )
println(1/3r + 2/7r * 2)
Expand All @@ -44,7 +43,7 @@ println(m)
println({v: k for k , v <- m})
println([k for k, _ <- m])
println( [ v for v <- m] )`,
want: `println("Hello, Go+")
want: `println("Hello, Go+")

println(1r << 129)
println(1/3r + 2/7r*2)
Expand Down
12 changes: 5 additions & 7 deletions playground/goplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ package main
import (
"log"

"github.com/qiniu/goplus/ast"
"github.com/qiniu/goplus/cl"
exec "github.com/qiniu/goplus/exec/bytecode"
"github.com/qiniu/goplus/parser"
"github.com/qiniu/goplus/token"

_ "github.com/qiniu/goplus/lib"
"github.com/goplus/gop/ast"
"github.com/goplus/gop/cl"
exec "github.com/goplus/gop/exec/bytecode"
"github.com/goplus/gop/parser"
"github.com/goplus/gop/token"
)

func buildGoplus(data string) {
Expand Down
9 changes: 5 additions & 4 deletions playground/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,11 @@ func sandboxBuildGoplus(ctx context.Context, tmpDir string, in []byte, vet bool)

br := new(buildResult)

qgo, err := exec.LookPath("qgo")
qgo, err := exec.LookPath("gop")
if err != nil {
return nil, fmt.Errorf("error find qgo command: %v", err)
}
cmdGenerate := exec.Command(qgo, ".")
cmdGenerate := exec.Command(qgo, "go", ".")
cmdGenerate.Dir = tmpDir

out := &bytes.Buffer{}
Expand All @@ -463,13 +463,14 @@ func sandboxBuildGoplus(ctx context.Context, tmpDir string, in []byte, vet bool)
}
if _, ok := err.(*exec.ExitError); ok {
br.errorMessage = br.errorMessage + strings.Replace(string(out.Bytes()), tmpDir+"/", "", -1)
br.errorMessage = strings.Replace(br.errorMessage, "# command-line-arguments\n", "", 1)
return br, nil
}
}

// until now, qgo does not provide process exit code, so we hard code this.
if strings.Contains(out.String(), "[ERROR]") {
if strings.Contains(out.String(), "errors") ||
strings.Contains(out.String(), "TODO") ||
strings.Contains(out.String(), "runtime error") {
br.errorMessage = br.errorMessage + strings.Replace(string(out.Bytes()), tmpDir+"/", "", -1)
br.errorMessage = strings.Replace(br.errorMessage, "# command-line-arguments\n", "", 1)
return br, nil
Expand Down