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" "context"
"fmt" "fmt"
"github.com/d5/tengo" "github.com/d5/tengo/v2"
) )
func main() { func main() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,9 +5,9 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/d5/tengo" "github.com/d5/tengo/v2"
"github.com/d5/tengo/parser" "github.com/d5/tengo/v2/parser"
"github.com/d5/tengo/require" "github.com/d5/tengo/v2/require"
) )
func TestCompiler_Compile(t *testing.T) { 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. input/output variables.
```golang ```golang
import "github.com/d5/tengo" import "github.com/d5/tengo/v2"
var code = ` var code = `
reduce := func(seq, fn) { reduce := func(seq, fn) {
@ -54,7 +54,7 @@ output variable is accessed through
import ( import (
"fmt" "fmt"
"github.com/d5/tengo" "github.com/d5/tengo/v2"
) )
func main() { func main() {

View file

@ -4,7 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/d5/tengo" "github.com/d5/tengo/v2"
) )
func Example() { 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 go 1.13

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

4
vm.go
View file

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

View file

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