FAQ
A little code cleanup http://play.golang.org/p/rwstdPSwNb

1. line 13: changed return. Now it's named. And because Go also zeros the
variable, there is no need to make it zero first.
2. line 20: remark: if you want this modifyable, return a pointer to
student.
3. line 37 to 49: There is no need for extra variables when you already
have a slice of the student struct. I also used range in the for loops.

On Sunday, October 27, 2013 10:15:51 AM UTC+1, Tamás Gulácsi wrote:

Hi,

1. use play.golang.org
2. Go does not have classes,
3. slices are already references, no need to use pointers for them (no
*[]student)
4. what does student.search do? Why is it a method of student if you don't
use the "s" student?

http://play.golang.org/p/Zhu3ohKwV8
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 7 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 27, '13 at 7:13a
activeOct 27, '13 at 7:05p
posts7
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase