This is a creation in Article, where the information may have evolved or changed.
The $19.8 and $19.9 inside of the "Go" demo:goto_5
$go version
Go version go1.1.2 darwin/amd64
$./goto_v5-http=:8081-rpc=true//When you start master, the following line is displayed:
2014/12/02 22:36:29 method Count has wrong number of ins:1
Func (S *urlstore) Put (URL, key *string) error {for {*key = Genkey (S.count ()) If err: = S.set (key, url); err = = Nil {break} }if S.save! = nil {s.save <-record{*key, *url}}return nil}func (S *urlstore) Count () int {s.mu.rlock () defer S.mu.runlo CK () return Len (S.urls)}
The reason for this prompt is:
1.RPC can only work through methods with the form (T is a value of type T):
Func (T-t) Name (args *argtype, reply *replytype) error
2.Count () This function is inherently private, but the error is public. Moreover, the parameters and return types of the function are inconsistent with the public function requirements that RPC can handle.
Goto_v1~goto_v4 These 4 versions did not add RPC, no problem.
GOTO_V5 used RPC to expose the problem.
Workaround:
Change the count of these two places to count, recompile, and run OK!
Reference: https://code.google.com/p/go/issues/detail?id=1056