From 7706921083cb1c8fefd4aabcb52374206a37e4a9 Mon Sep 17 00:00:00 2001 From: peefy Date: Fri, 26 Jul 2024 21:30:45 +0800 Subject: [PATCH] feat: set fast eval mode as default Signed-off-by: peefy --- pkg/kcl/{native_service.go => rpc_service.go} | 11 ++++------- pkg/kcl/service.go | 11 +++++++---- pkg/plugin/api.go | 10 ---------- pkg/runtime/kclvm.go | 1 + 4 files changed, 12 insertions(+), 21 deletions(-) rename pkg/kcl/{native_service.go => rpc_service.go} (66%) diff --git a/pkg/kcl/native_service.go b/pkg/kcl/rpc_service.go similarity index 66% rename from pkg/kcl/native_service.go rename to pkg/kcl/rpc_service.go index bf0f00e2..5eaafab4 100644 --- a/pkg/kcl/native_service.go +++ b/pkg/kcl/rpc_service.go @@ -1,16 +1,13 @@ -//go:build !rpc -// +build !rpc +//go:build rpc +// +build rpc package kcl -import ( - "kcl-lang.io/kcl-go/pkg/native" - "kcl-lang.io/kcl-go/pkg/service" -) +import "kcl-lang.io/kcl-go/pkg/service" // Service returns the interaction interface between KCL Go SDK and KCL Rust core. // When `go build tags=native` is opened, use CGO and dynamic libraries to interact. // When closed, use the default RPC interaction logic to avoid CGO usage. func Service() service.KclvmService { - return native.NewNativeServiceClient() + return service.NewKclvmServiceClient() } diff --git a/pkg/kcl/service.go b/pkg/kcl/service.go index 5eaafab4..bf0f00e2 100644 --- a/pkg/kcl/service.go +++ b/pkg/kcl/service.go @@ -1,13 +1,16 @@ -//go:build rpc -// +build rpc +//go:build !rpc +// +build !rpc package kcl -import "kcl-lang.io/kcl-go/pkg/service" +import ( + "kcl-lang.io/kcl-go/pkg/native" + "kcl-lang.io/kcl-go/pkg/service" +) // Service returns the interaction interface between KCL Go SDK and KCL Rust core. // When `go build tags=native` is opened, use CGO and dynamic libraries to interact. // When closed, use the default RPC interaction logic to avoid CGO usage. func Service() service.KclvmService { - return service.NewKclvmServiceClient() + return native.NewNativeServiceClient() } diff --git a/pkg/plugin/api.go b/pkg/plugin/api.go index e401420d..32078f9d 100644 --- a/pkg/plugin/api.go +++ b/pkg/plugin/api.go @@ -3,20 +3,10 @@ package plugin import ( - "os" "strings" "sync" ) -// Debug flag for kcl-plugin -var DebugMode = false - -func init() { - if s := strings.ToLower(os.Getenv("KCLVM_PLUGIN_DEBUG")); s != "" && s != "false" && s != "0" { - DebugMode = true - } -} - var pluginManager struct { allPlugin map[string]Plugin allMethodSpec map[string]MethodSpec diff --git a/pkg/runtime/kclvm.go b/pkg/runtime/kclvm.go index b0c1094d..bb2adc40 100644 --- a/pkg/runtime/kclvm.go +++ b/pkg/runtime/kclvm.go @@ -20,6 +20,7 @@ import ( ) func init() { + env.EnableFastEvalMode() if !env.GetDisableInstallArtifact() { installKclArtifact() }