add go module v2 (#244)

This commit is contained in:
daniel 2019-12-29 13:38:51 -08:00 committed by GitHub
parent a9a233a750
commit d5b24138d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 94 additions and 94 deletions

View file

@ -84,7 +84,7 @@ import (
"context"
"fmt"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func main() {

View file

@ -6,7 +6,7 @@ import (
"io"
"reflect"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/v2/parser"
)
// Bytecode is a compiled instructions and constants.

View file

@ -5,9 +5,9 @@ import (
"testing"
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/require"
)
type srcfile struct {

View file

@ -4,8 +4,8 @@ import (
"fmt"
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
)
func main() {

View file

@ -11,9 +11,9 @@ import (
"path/filepath"
"strings"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/stdlib"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/stdlib"
)
const (

View file

@ -8,8 +8,8 @@ import (
"reflect"
"strings"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/token"
)
// compilationScope represents a compiled instructions and the last two

View file

@ -5,9 +5,9 @@ import (
"strings"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/require"
)
func TestCompiler_Compile(t *testing.T) {

View file

@ -26,7 +26,7 @@ The following is an example where a Tengo script is compiled and run with no
input/output variables.
```golang
import "github.com/d5/tengo"
import "github.com/d5/tengo/v2"
var code = `
reduce := func(seq, fn) {
@ -54,7 +54,7 @@ output variable is accessed through
import (
"fmt"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func main() {

View file

@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func Example() {

2
go.mod
View file

@ -1,3 +1,3 @@
module github.com/d5/tengo
module github.com/d5/tengo/v2
go 1.13

View file

@ -3,7 +3,7 @@ package tengo
import (
"fmt"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/v2/parser"
)
// MakeInstruction returns a bytecode for an opcode and the operands.

View file

@ -8,8 +8,8 @@ import (
"strings"
"time"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/token"
)
var (

View file

@ -3,9 +3,9 @@ package tengo_test
import (
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/token"
)
func TestObject_TypeName(t *testing.T) {

View file

@ -3,7 +3,7 @@ package parser_test
import (
"testing"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/v2/parser"
)
func TestIdentListString(t *testing.T) {

View file

@ -3,7 +3,7 @@ package parser
import (
"strings"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/token"
)
// Expr represents an expression node in the AST.

View file

@ -6,7 +6,7 @@ import (
"sort"
"strconv"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/token"
)
type bailout struct{}

View file

@ -7,9 +7,9 @@ import (
"strings"
"testing"
. "github.com/d5/tengo/parser"
"github.com/d5/tengo/require"
"github.com/d5/tengo/token"
. "github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/token"
)
func TestParserError(t *testing.T) {

View file

@ -5,7 +5,7 @@ import (
"unicode"
"unicode/utf8"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/token"
)
// byte order mark

View file

@ -7,9 +7,9 @@ import (
"testing"
"time"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/require"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/token"
)
var testFileSet = parser.NewFileSet()

View file

@ -3,7 +3,7 @@ package parser
import (
"strings"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/token"
)
// Stmt represents a statement in the AST.

View file

@ -10,9 +10,9 @@ import (
"unicode"
"unicode/utf8"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/token"
)
// NoError asserts err is not an error.

View file

@ -5,7 +5,7 @@ import (
"fmt"
"sync"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/v2/parser"
)
// Script can simplify compilation and execution of embedded scripts.

View file

@ -10,10 +10,10 @@ import (
"testing"
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/stdlib"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/stdlib"
"github.com/d5/tengo/v2/token"
)
func TestScript_Add(t *testing.T) {

View file

@ -3,7 +3,7 @@ package stdlib
import (
"encoding/base64"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var base64Module = map[string]tengo.Object{

View file

@ -1,7 +1,7 @@
package stdlib
import (
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
// BuiltinModules are builtin type standard library modules.

View file

@ -1,7 +1,7 @@
package stdlib
import (
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func wrapError(err error) tengo.Object {

View file

@ -3,7 +3,7 @@ package stdlib
import (
"fmt"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var fmtModule = map[string]tengo.Object{

View file

@ -3,7 +3,7 @@ package stdlib
import (
"fmt"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
// FuncAR transform a function of 'func()' signature into CallableFunc type.

View file

@ -6,9 +6,9 @@ import (
"strings"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/stdlib"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/stdlib"
)
func TestFuncAIR(t *testing.T) {

View file

@ -3,7 +3,7 @@ package stdlib
import (
"encoding/hex"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var hexModule = map[string]tengo.Object{

View file

@ -4,8 +4,8 @@ import (
"bytes"
gojson "encoding/json"
"github.com/d5/tengo"
"github.com/d5/tengo/stdlib/json"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/stdlib/json"
)
var jsonModule = map[string]tengo.Object{

View file

@ -12,7 +12,7 @@ import (
"unicode/utf16"
"unicode/utf8"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
// Decode parses the JSON-encoded data and returns the result object.

View file

@ -12,7 +12,7 @@ import (
"math"
"strconv"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
// Encode returns the JSON encoding of the object.

View file

@ -4,9 +4,9 @@ import (
gojson "encoding/json"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/stdlib/json"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/stdlib/json"
)
type ARR = []interface{}

View file

@ -3,7 +3,7 @@ package stdlib
import (
"math"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var mathModule = map[string]tengo.Object{

View file

@ -7,7 +7,7 @@ import (
"os"
"os/exec"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var osModule = map[string]tengo.Object{

View file

@ -3,7 +3,7 @@ package stdlib
import (
"os/exec"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func makeOSExecCommand(cmd *exec.Cmd) *tengo.ImmutableMap {

View file

@ -3,7 +3,7 @@ package stdlib
import (
"os"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func makeOSFile(file *os.File) *tengo.ImmutableMap {

View file

@ -4,7 +4,7 @@ import (
"os"
"syscall"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func makeOSProcessState(state *os.ProcessState) *tengo.ImmutableMap {

View file

@ -5,8 +5,8 @@ import (
"os"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
)
func TestReadFile(t *testing.T) {

View file

@ -3,7 +3,7 @@ package stdlib
import (
"math/rand"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var randModule = map[string]tengo.Object{

View file

@ -4,8 +4,8 @@ import (
"math/rand"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
)
func TestRand(t *testing.T) {

View file

@ -3,7 +3,7 @@ package stdlib
//go:generate go run gensrcmods.go
import (
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
// AllModuleNames returns a list of all default module names.

View file

@ -5,9 +5,9 @@ import (
"testing"
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/stdlib"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/stdlib"
)
type ARR = []interface{}

View file

@ -7,7 +7,7 @@ import (
"strings"
"unicode/utf8"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var textModule = map[string]tengo.Object{

View file

@ -3,7 +3,7 @@ package stdlib
import (
"regexp"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func makeTextRegexp(re *regexp.Regexp) *tengo.ImmutableMap {

View file

@ -4,7 +4,7 @@ import (
"regexp"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
func TestTextRE(t *testing.T) {

View file

@ -3,7 +3,7 @@ package stdlib
import (
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/v2"
)
var timesModule = map[string]tengo.Object{

View file

@ -4,8 +4,8 @@ import (
"testing"
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
)
func TestTimes(t *testing.T) {

View file

@ -3,8 +3,8 @@ package tengo_test
import (
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
)
func TestSymbolTable(t *testing.T) {

View file

@ -5,9 +5,9 @@ import (
"testing"
"time"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/require"
)
func TestInstructions_String(t *testing.T) {

View file

@ -3,8 +3,8 @@ package tengo_test
import (
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/require"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/require"
)
type VariableTest struct {

4
vm.go
View file

@ -4,8 +4,8 @@ import (
"fmt"
"sync/atomic"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/token"
)
// frame represents a function call frame.

View file

@ -10,11 +10,11 @@ import (
"strings"
"testing"
"github.com/d5/tengo"
"github.com/d5/tengo/parser"
"github.com/d5/tengo/require"
"github.com/d5/tengo/stdlib"
"github.com/d5/tengo/token"
"github.com/d5/tengo/v2"
"github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/v2/require"
"github.com/d5/tengo/v2/stdlib"
"github.com/d5/tengo/v2/token"
)
const testOut = "out"