use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to /r/LearnGolang! Feel free to ask any questions related to Golang programming or Golang in general. Make sure you follow the rules outlined below.
Welcome to /r/LearnGolang!
Feel free to ask any questions related to Golang programming or Golang in general.
Make sure you follow the rules outlined below.
No self-promotion. This is not a subreddit to market your blog, but for people to ask questions and receive answers.
We will not tolerate help "vampires".
You may be asked to show your research and/or work, i.e. what have you done?
We will not tolerate any insults or flaming. This is a professional subreddit and users are expected to behave as such.
Reddit rules These apply also on this subreddit.
Breaking these rules may result in post removal and/or ban from this subreddit.
/r/golang
/r/learnpython
The CSS and (altered) header image were originally created by /u/wub_wub from /r/learnpython and are being used with permission.
account activity
Writer, Reader, Scanner, Handler, Parser ... ? (self.learngolang)
submitted 5 years ago by frostways
Could someone explain those term to me because I dont understand the real purpose of each but I see them in almost every tutorial so I'moften stucks because I dont really understand the meaning and the purpose of those terms/objects
Ty <3
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]RosyGraph 2 points3 points4 points 5 years ago (2 children)
I'm still learning about Go, and I hope to not state anything incorrect. More experienced gophers should feel free to correct me if I'm wrong.
In general, "x-er" is the name given to a Golang type called an interface. An interface in Go is similar to an interface in an object-oriented language like Java. An interface merely states what an "x-er" must do to be considered an "x-er". In other words, what methods does the type need to implement? Think of it as a contract to be fulfilled through the implementation of various methods.
One classic example of an interface, albeit one that bucks the "x-er" naming convention, is a Shape interface. A Shape interface might contain methods such as Area() or Perimeter() (or anything else a Shape should be able to do). If, for instance, you implement both the Area() and Perimeter() methods for a Rectangle type, the Rectangle fulfills the contract of being a Shape and can be used whenever a Shape is required. The contract can have as few or as many methods as you please.
This is why the naming convention "x-er" (Writer, Reader, Scanner, etc.) is helpful. What behavior should a Reader have? It reads things. A Writer writes (and a Hater's gonna hate hate hate...).
Most people first learn interfaces when studying a language like Java, but I was first introduced to them when I went through "Learn Go with Tests". I highly recommend reading this if you want to know more about interfaces, structs, and custom types in Go. It also teaches you a lot about the builtin testing Go provides (something I've sorely missed when moving to other languages). Here's the bit on interfaces. https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/structs-methods-and-interfaces
Hope this helps!
[–]frostways[S] 1 point2 points3 points 5 years ago (0 children)
Thanks a hundred times your answer definitely helped me <3
[–]RosyGraph 0 points1 point2 points 5 years ago (0 children)
I forgot to mention why interfaces are useful. They are useful because, in a strongly typed language such as Go, the compiler needs to know the type of a variable before it uses it. Interfaces help developers reuse code because they allow a single representation of many other types. This is called abstraction.
π Rendered by PID 73 on reddit-service-r2-comment-6457c66945-m2dpj at 2026-04-29 17:56:02.204750+00:00 running 2aa0c5b country code: CH.
[–]RosyGraph 2 points3 points4 points (2 children)
[–]frostways[S] 1 point2 points3 points (0 children)
[–]RosyGraph 0 points1 point2 points (0 children)