Go+ 组织变更,并发布 weekly release: v0.7.1

这周时间虽然短,但是对 Go+ 来说发生了很多事情。最重要的一件事情当然是组织变更:我们有了 goplus 这个 github 组织啦。从代码管理的角度,这个影响不小,所以我们将版本号升级到了 v0.7.x。

第二件大事是 gop 命令千呼万唤终于出来了。qrun、qgo、qfmt、qexp 这几个命令全部能力被集成到一个统一的 gop 命令中。当然遗憾的是 gop 还没有支持一些 go 的常见子命令,比如 go install。预计下周会增加 gop install 命令。

第三件大事是 Go+ 有了 vscode 插件。大家可以直接在 vscode 中搜索 goplus 找到它。项目主页:https://github.com/gopcode/vscode-goplus。

为了简化未来的开发工作,我们对测试案例的写法上做了大幅简化。为此我们提供了一个测试框架:https://github.com/qiniu/x/wiki/How-to-write-a-TestCase。在此基础上,我们的绝大部分测试案例基本都一句话的事情。更详细的内容参见下文的 Release Notes。

Github 的 badge 是个很有意思的东西。为了方便用户可以快速了解 Go+,我们对 badge 版式做了一次较大幅度的调整。见下图:

以下是完整的 Release Notes:

Organization & Repo

Move github.com/qiniu/goplus to github.com/goplus/gop.
Move github.com/qiniu/goplus-www to github.com/goplus/www.
Move github.com/qiniu/goplus-play to github.com/goplusjs/play.

Thanks contribution of astaxie (astaxie@goplus.org), visualfc (visualfc@goplus.org).

Commands

gop run         # Run a Go+ program
gop go [-test]  # Convert Go+ packages into Go packages. If -test specified, it tests related packages.
gop fmt         # Format Go+ packages
gop export      # Export Go packages for Go+ programs
gop run (ie. qrun)

Run <gopSrcDir|gopSrcFile> as a Go+ script.

Usage: gop run [-asm -quiet -debug -prof] <gopSrcDir|gopSrcFile>
  -asm
    	generates `asm` code of Go+ bytecode backend
  -debug
    	print debug information
  -prof
    	do profile and generate profile report
  -quiet
    	don't generate any compiling stage log

Here are some examples:

gop run <gopSrcDir|gopSrcFile>        # gop run <gopSrcDir | gopSrcFile>
gop run -asm <gopSrcDir|gopSrcFile>   # generates `asm` code of Go+ bytecode backend
gop run -quiet <gopSrcDir|gopSrcFile> # don't generate any compiling stage log
gop run -debug <gopSrcDir|gopSrcFile> # print debug information
gop run -prof <gopSrcDir|gopSrcFile>  # do profile and generate profile report
gop fmt (ie. qfmt)

Format Go+ packages.

Usage: gop fmt [-w] [path ...]
  -w	write result to (source) file instead of stdout
gop export (ie. qexp)

Generate a Go+ package that wraps a Go package automatically.

Usage: gop export [-outdir <outRootDir>] <goPkgPath>
  -outdir string
    	optional set export lib path, default is $GoPlusRoot/lib path.
gop go (ie. qgo)

Convert all Go+ packages under into Go packages, recursively.

Usage: gop go [-test] <gopSrcDir>
  -test
    	test Go+ package

Here are some examples:

gop go <gopSrcDir> # gop go <gopSrcDir>
gop go -test <gopSrcDir>

Note:

  • gop go -test <gopSrcDir> converts Go+ packages into Go packages, and for every package, it call go run <gopPkgDir>/gop_autogen.go and gop run -quiet <gopPkgDir> to compare their outputs. If their outputs aren't equal, the test case fails.

Simplify test cases

import (
	"math/big"
	"testing"

	"github.com/goplus/gop/cl/cltest"
)

func TestMake(t *testing.T) {
	cltest.Expect(t, `
		a := make([]int, 0, 4)
		a = append(a, [1, 2, 3]...)
		println(a)
	`,
		"[1 2 3]\n",
	)
}

func TestPanic(t *testing.T) {
	cltest.Expect(t,
		`panic("Helo")`, "", "Helo",
	)
}

func TestRational(t *testing.T) {
	cltest.Call(t, `
		a := 3/4r
		x := a + 5/7r
		x
	`).Equal(big.NewRat(41, 28))
}

See https://github.com/qiniu/x/wiki/How-to-write-a-TestCase.

Go+ related packages

  • gop/constant

Import Go packages

  • variables read/write

Thanks contribution of visualfc (visualfc@goplus.org).

Builtin

  • copy

Thanks contribution of JessonChan (chendongpo@goplus.org).

IDE Plugins

  • github.com/gopcode/vscode-goplus

Thanks contribution of go-wyvern (wuxinyi@goplus.org).

Go+ Badges

Contributing

Where can you start?

Misc

  • Simplify test cases of cl/expr_test.go.

  • Deduplicate code in package token/scanner.

Thanks contribution of wangkuiyi (wangyi@goplus.org), tsingbx.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值