Skip to content

Commit ccc218b

Browse files
committed
docs: update kcl go plugin example code
Signed-off-by: peefy <[email protected]>
1 parent ca29b95 commit ccc218b

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

docs/reference/plugin/overview.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ package main
2424
import (
2525
"fmt"
2626

27-
"kcl-lang.io/kcl-go/pkg/kcl"
28-
"kcl-lang.io/kcl-go/pkg/native" // Import the native API
27+
"kcl-lang.io/kcl-go/pkg/kcl" // Import the native API
2928
_ "kcl-lang.io/kcl-go/pkg/plugin/hello_plugin" // Import the hello plugin
3029
)
3130

3231
func main() {
33-
// Note we use `native.MustRun` here instead of `kcl.MustRun`, because it needs the cgo feature.
34-
yaml := native.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
32+
yaml := kcl.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
3533
fmt.Println(yaml)
3634
}
3735

i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/plugin/overview.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ package main
2424
import (
2525
"fmt"
2626

27-
"kcl-lang.io/kcl-go/pkg/kcl"
28-
"kcl-lang.io/kcl-go/pkg/native" // Import the native API
27+
"kcl-lang.io/kcl-go/pkg/kcl" // Import the native API
2928
_ "kcl-lang.io/kcl-go/pkg/plugin/hello_plugin" // Import the hello plugin
3029
)
3130

3231
func main() {
33-
// Note we use `native.MustRun` here instead of `kcl.MustRun`, because it needs the cgo feature.
34-
yaml := native.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
32+
yaml := kcl.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
3533
fmt.Println(yaml)
3634
}
3735

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/reference/plugin/overview.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ package main
2424
import (
2525
"fmt"
2626

27-
"kcl-lang.io/kcl-go/pkg/kcl"
28-
"kcl-lang.io/kcl-go/pkg/native" // Import the native API
27+
"kcl-lang.io/kcl-go/pkg/kcl" // Import the native API
2928
_ "kcl-lang.io/kcl-go/pkg/plugin/hello_plugin" // Import the hello plugin
3029
)
3130

3231
func main() {
33-
// Note we use `native.MustRun` here instead of `kcl.MustRun`, because it needs the cgo feature.
34-
yaml := native.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
32+
yaml := kcl.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
3533
fmt.Println(yaml)
3634
}
3735

versioned_docs/version-0.10/reference/plugin/overview.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ package main
2424
import (
2525
"fmt"
2626

27-
"kcl-lang.io/kcl-go/pkg/kcl"
28-
"kcl-lang.io/kcl-go/pkg/native" // Import the native API
27+
"kcl-lang.io/kcl-go/pkg/kcl" // Import the native API
2928
_ "kcl-lang.io/kcl-go/pkg/plugin/hello_plugin" // Import the hello plugin
3029
)
3130

3231
func main() {
33-
// Note we use `native.MustRun` here instead of `kcl.MustRun`, because it needs the cgo feature.
34-
yaml := native.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
32+
yaml := kcl.MustRun("main.k", kcl.WithCode(code)).GetRawYamlResult()
3533
fmt.Println(yaml)
3634
}
3735

0 commit comments

Comments
 (0)