# Go RPC do not pass the args

**URL:** <https://forum.golangbridge.org/t/go-rpc-do-not-pass-the-args/29543>\
**Category:** Getting Help\
**Created:** [November 12, 2022, 10:18am UTC](https://forum.golangbridge.org/t/go-rpc-do-not-pass-the-args/29543 "2022-11-12T10:18:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukeLIN-web](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/lukelin-web/32/12337_2.png) [@LukeLIN-web](https://forum.golangbridge.org/u/LukeLIN-web)\
**Post date:** [November 12, 2022, 10:18am UTC](https://forum.golangbridge.org/t/go-rpc-do-not-pass-the-args/29543/1 "2022-11-12T10:18:24Z")

</div>

I am doing MIT 6.824, but meet some problems:

I pass args : &{1 2 0 -1} ,reply := AppendEntriesReply{} to example RequestVote RPC handler.

```go
func (rf *Raft) RequestVote(args *RequestVoteArgs, reply *RequestVoteReply) {
	fmt.Println(args) // it is nil! 
	if args.term > rf.currentTerm {
		rf.currentTerm = args.term
		rf.state = Follower
	} 

	if args.term <= rf.currentTerm {
		reply.Granted = false
		reply.Term = rf.currentTerm
	}
	if args.lastLogIndex >= len(rf.log) && (rf.votedFor == -1 || rf.votedFor == args.candidateId) {
		reply.Granted = true
	} else {
		reply.Granted = false
	}
	reply.Term = rf.currentTerm
	return
}

func (rf *Raft) sendRequestVote(server int, args *RequestVoteArgs, reply *RequestVoteReply) bool {
	fmt.Println(args)
	ok := rf.peers[server].Call("Raft.RequestVote", args, reply)
	return ok
}

```

My RPC call do not pass the args. Why, but I am using the basic lib.

---

<div class="post-metadata">

**Author:** ![LukeLIN-web](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/lukelin-web/32/12337_2.png) [@LukeLIN-web](https://forum.golangbridge.org/u/LukeLIN-web)\
**Post date:** [November 12, 2022, 10:20am UTC](https://forum.golangbridge.org/t/go-rpc-do-not-pass-the-args/29543/2 "2022-11-12T10:20:34Z")

</div>

I know, it is because the args need a capital letter at the beginning!

---

<div class="post-metadata">

**Author:** ![system](https://forum.golangbridge.org/uploads/default/original/2X/5/5ad234f7c3dbc68b6cc72d338ce4f2973d9fd81c.png) [@system](https://forum.golangbridge.org/u/system)\
**Post date:** [February 10, 2023, 10:21am UTC](https://forum.golangbridge.org/t/go-rpc-do-not-pass-the-args/29543/3 "2023-02-10T10:21:19Z")

</div>

Closed on February 10, 2023, 10:21am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
