Skip to content

Commit

Permalink
change examples/basic/commons go package name to shared, and date doc
Browse files Browse the repository at this point in the history
Signed-off-by: Niu Lechuan <lechuan.niu@daocloud.io>
  • Loading branch information
Niu Lechuan committed Oct 12, 2022
1 parent f19a125 commit f836044
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/extensive-go-plugin-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ And last but not least is the `Plugins` map. This map is used in order to identi

~~~go
// pluginMap is the map of plugins we can dispense.
var pluginMap = map[string]plugin.Plugin{"greeter": &example.GreeterPlugin{}}
var pluginMap = map[string]plugin.Plugin{"greeter": &shared.GreeterPlugin{}}
~~~

You can see that the key is the name of the plugin and the value is the plugin.
Expand Down Expand Up @@ -126,7 +126,7 @@ Now, the magic:
~~~go
// We should have a Greeter now! This feels like a normal interface
// implementation but is in fact over an RPC connection.
greeter := raw.(example.Greeter)
greeter := raw.(shared.Greeter)
fmt.Println(greeter.Greet())
~~~

Expand Down Expand Up @@ -277,7 +277,7 @@ greeter := &GreeterHello{
}
// pluginMap is the map of plugins we can dispense.
var pluginMap = map[string]plugin.Plugin{
"greeter": &example.GreeterPlugin{Impl: greeter},
"greeter": &shared.GreeterPlugin{Impl: greeter},
}

logger.Debug("message from plugin", "foo", "bar")
Expand Down
6 changes: 3 additions & 3 deletions examples/basic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-plugin/examples/basic/commons"
"github.com/hashicorp/go-plugin/examples/basic/shared"
)

func main() {
Expand Down Expand Up @@ -42,7 +42,7 @@ func main() {

// We should have a Greeter now! This feels like a normal interface
// implementation but is in fact over an RPC connection.
greeter := raw.(example.Greeter)
greeter := raw.(shared.Greeter)
fmt.Println(greeter.Greet())
}

Expand All @@ -58,5 +58,5 @@ var handshakeConfig = plugin.HandshakeConfig{

// pluginMap is the map of plugins we can dispense.
var pluginMap = map[string]plugin.Plugin{
"greeter": &example.GreeterPlugin{},
"greeter": &shared.GreeterPlugin{},
}
4 changes: 2 additions & 2 deletions examples/basic/plugin/greeter_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-plugin/examples/basic/commons"
"github.com/hashicorp/go-plugin/examples/basic/shared"
)

// Here is a real implementation of Greeter
Expand Down Expand Up @@ -40,7 +40,7 @@ func main() {
}
// pluginMap is the map of plugins we can dispense.
var pluginMap = map[string]plugin.Plugin{
"greeter": &example.GreeterPlugin{Impl: greeter},
"greeter": &shared.GreeterPlugin{Impl: greeter},
}

logger.Debug("message from plugin", "foo", "bar")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package example
package shared

import (
"net/rpc"
Expand Down

0 comments on commit f836044

Please sign in to comment.