Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit103dd8d

Browse files
per1234Massimiliano Pippi
authored and
Massimiliano Pippi
committed
[skip changelog] Demonstrate gRPC interface's LibraryResolveDependencies method in client_example (#552)
1 parent23e4d70 commit103dd8d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

‎client_example/go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ require (
66
github.com/arduino/arduino-cliv0.0.0-20200109150215-ffa84fdaab21
77
github.com/gosuri/uitablev0.0.0-20160404203958-36ee7e946282// indirect
88
google.golang.org/grpcv1.23.0
9-
)
9+
)

‎client_example/main.go‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ func main() {
164164
log.Println("calling LibrarySearch(audio)")
165165
callLibSearch(client,instance)
166166

167+
// List the dependencies of the ArduinoIoTCloud library
168+
log.Println("calling LibraryResolveDependencies(ArduinoIoTCloud)")
169+
callLibraryResolveDependencies(client,instance)
170+
167171
// List installed libraries
168172
log.Println("calling LibraryList")
169173
callLibList(client,instance)
@@ -734,6 +738,26 @@ func callLibSearch(client rpc.ArduinoCoreClient, instance *rpc.Instance) {
734738
}
735739
}
736740

741+
funccallLibraryResolveDependencies(client rpc.ArduinoCoreClient,instance*rpc.Instance) {
742+
libraryResolveDependenciesResp,err:=client.LibraryResolveDependencies(context.Background(),
743+
&rpc.LibraryResolveDependenciesReq{
744+
Instance:instance,
745+
Name:"ArduinoIoTCloud",
746+
})
747+
748+
iferr!=nil {
749+
log.Fatalf("Error listing library dependencies: %s",err)
750+
}
751+
752+
for_,resp:=rangelibraryResolveDependenciesResp.GetDependencies() {
753+
log.Printf("Dependency Name: %s",resp.GetName())
754+
log.Printf("Version Required: %s",resp.GetVersionRequired())
755+
ifresp.GetVersionInstalled()!="" {
756+
log.Printf("Version Installed: %s\n",resp.GetVersionInstalled())
757+
}
758+
}
759+
}
760+
737761
funccallLibList(client rpc.ArduinoCoreClient,instance*rpc.Instance) {
738762
libLstResp,err:=client.LibraryList(context.Background(),
739763
&rpc.LibraryListReq{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp