Skip to content

Commit

Permalink
Merge pull request #147 from kcl-lang/docs-update-go-binding-docs
Browse files Browse the repository at this point in the history
docs: update go binding readme docs
  • Loading branch information
Peefy authored Sep 16, 2024
2 parents 7915feb + f8b33fc commit ce51f3e
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,22 @@ Write the Code
package main

import (
"kcl-lang.io/lib/go/install"
"fmt"

"kcl-lang.io/lib/go/api"
"kcl-lang.io/lib/go/native"
)

func main() {
path = "path/to/install/lib"
_ := install.InstallKclvm(path)
client := native.NewNativeServiceClient()
result, err := client.ExecProgram(&api.ExecProgram_Args{
KFilenameList: []string{"main.k"},
KCodeList: []string{"a = 1"},
})
if err != nil {
t.Fatal(err)
}
fmt.Println(result.YamlResult)
}
```

Expand Down Expand Up @@ -85,7 +95,7 @@ This way you'll be able to import the above dependency to use the SDK.
<dependency>
<groupId>com.kcl</groupId>
<artifactId>kcl-lib</artifactId>
<version>0.10.0-rc.1-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
</dependency>
```

Expand Down Expand Up @@ -187,7 +197,7 @@ This way you'll be able to import the above dependency to use the SDK.
<dependency>
<groupId>com.kcl</groupId>
<artifactId>kcl-lib</artifactId>
<version>0.10.0-rc.1-SNAPSHOT</version>
<version>0.10.0-SNAPSHOT</version>
</dependency>
```

Expand Down Expand Up @@ -221,7 +231,7 @@ For CMake, you can use FetchContent to add KCL C++ Lib to your project.
FetchContent_Declare(
kcl-lib
GIT_REPOSITORY https://github.com/kcl-lang/lib.git
GIT_TAG v0.10.0-rc.1
GIT_TAG v0.10.0
SOURCE_SUBDIR cpp
)
FetchContent_MakeAvailable(kcl-lib)
Expand Down

0 comments on commit ce51f3e

Please sign in to comment.