https://chenyitian.gitbooks.io/gin-tutorials/
Has anybody tried this tutorial about gin + golang ? I attempted studying gin and golang through this, however my code ended up in lots of issues with this. Additionally, in my restricted understanding of golang, this tutorial form of has lots of unformal issues like utilizing file names like handlers.article.go
as a substitute of handlers/article.go
and doubtless declaring the bundle to handlers. The entire information are packaged underneath predominant.
Am I lacking one thing, I’d prefer to know if somebody has accomplished this tutorial.
To start with, I don’t suggest novices to begin with gin straight, although it’s extremely advisable by many individuals.
I personally suggest studying from the usual library’s http to grasp the design construction, processing logic, and so on. When you will have principally mastered the usual library’s http, you will see it straightforward to get began with these third-party libraries.
As for this tutorial, after a fast look, it doesn’t appear to be very nutritious.
Yeah. Additionally, I don’t imagine in all of the factor with mastering and all. I prefer to strive work out all the things on the go. And I’ve first rate understanding of construction and processing logs, I’m coming right here after attempting to work on a sufficiently big go code-base (did do some PR’s although). My seniors simply needed me to do that tutorial in order that I can have even higher understanding of our codebase which closely utilises gin.
So why don’t you try the official documentation?
Properly, I feel you’re de-railing within the flawed course. I needed to know ideas about that tutorial. The subject wasn’t very very very particular to “Gin” on the first place. It was whether or not anybody else had felt the identical factor concerning the tutorial like I did.
Anyhow, I’d like to attend and see if anybody can share something useful or temporary concerning the tutorial
Properly, it appears to be my downside.
I’m not sufficient to learn the tutorial you talked about in full. However after a fast overview, the tutorial offers me the identical feeling as I stated earlier than. Nevertheless, such public tutorials can’t be judged too strictly.
Yeah agreed. I observed the problems after 2-3 pages itself of the gitbook. I had thrown myself straight into the codebase for some duties, so I needed to fiddle with issues and whereas doing that I form of understood the entire construction a codebase must need to run a backend correctly. And I observed this tutorial doesn’t observe the construction in any respect.
I attempted distributing the codebase into totally different packages (handlers, fashions and testing) however the undefined
errors stored happening. Most likely, i’ll attempt to debug em or simply ask me supervisor to provide me one other activity straight
I skimmed the codebase and agree that issues like handlers.articles.go
are a bit odd. It’s additionally not very idiomatic to have common_test.go
. I feel they had been attempting to interrupt issues into separate information whereas retaining the bundle construction flat. Discover there’s no go.mod
? As a result of this undertaking predates go modules (the preliminary commit is June 14, 2016!). So, I feel this was a strategy to hold issues flat/easy earlier than modules existed (and sure idioms had been much less rooted locally again then) and it’s since outdated.
In case you’re caught on one thing, speak to the senior devs who assigned you to undergo that tutorial. I’m certain they’d a particular cause in thoughts. In case you’re struggling, ask for assist (it’s their job and it’s vastly most well-liked when junior builders ask for assist relatively than thrash round on their very own for too lengthy!). It is perhaps one thing like: one of many modules that you’re sustaining is 11 years outdated and predates Go Modules as nicely and thus they need you to know the way their legacy code seems, and so on.
1 Like
Thanks @Dean_Davidson for the reason. Proper, I additionally suspected that its most likely a really outdated tutorial.
Sure, I’ll report the identical to my senior. Its much less probably that we now have an outdated undertaking. As a result of our firm and the undertaking itself is simply 5 years outdated. Now, I’m curious why I used to be particularly given this tutorial to construct understanding of Go and Gin to grasp our codebase higher.
@Dean_Davidson Are you able to recommend any good tutorials for constructing familiarity with backend targeted golang and gin tutorials ? I talked to him and he stated that he simply randomly gave this and simply needs me to construct familiarity and fluency with the language and framework for higher understanding. Another tutorial can be high-quality too.
As @peakedshout talked about, the examples within the official documentation are fairly exhaustive. Additionally there’s a getting began information on go.dev nevertheless it’s extra primary. You’re going to largely study by constructing stuff, so I’d simply decide one thing you need to construct and construct it.
1 Like
Yup, I checked that tutorial out and likewise discovered a earlier thread the place you steered it. And I feel its too primary and doesn’t excite me :(. Likely, I’ll confront with my senior to begin constructing one thing to construct extra understanding of the codebase.
Another query for you, how do you study or examine a couple of codebase ? Is there any particular method you will have. I set to work on a tiny characteristic final to final week on our go codebase. How I went for it was: I pin the duty on my display screen, constructing a pseudo algorithm and principally give construction to what I need. Begin search within the codebase for related strategies/capabilities to seek for something which is already made with ripgrep or neovim telescope, in order that I don’t repeat it, and perceive if the characteristic I’m writing goes into the Handlers, controllers or repository of the codebase and simply begin writing it.
Would like to know your method
I’m unsure what you imply.
In case you imply how one can study a model new code base. Then my method is to first perceive what it’s, then what strategies there are (some code bases have tutorial code), after which attempt to name it to construct your individual demo code.
In case you imply to study extra concerning the code base, I feel there’s nothing extra rewarding than writing a alternative your self. (Like most of my programming information, I realized it as a result of I needed to do one thing)
If you’re engaged on a decently massive codebase the place you don’t need to rewrite your individual, that’s when growing the understanding of your present codebase comes into play. I used to be a naive non-programmer earlier than I began and whereas writing that tiny characteristic I learnt some issues concerning the codebase. We’re a Software program Service therefore, there are lots of operate/methodology calls, db writes and and so on taking place each second, so any of that calls may very well be useful.
I feel my query was fairly easy however yeah most likely it confused the reader due to the reason I did after the query.
If you’re studying utility providers, the simplest method is to learn the supply code from the entry level.
If you’re studying software libraries, the simplest method is to learn the supply code from the exported international strategies and buildings.
This can be a methodology for international studying. If you wish to perceive it in a focused method, it’s possible you’ll have to find the supply code you want and browse it.
That is my private studying methodology. After all, essentially the most satisfying method is to study by demo code.
1 Like
It actually relies upon. The extra expertise you get, the extra it is possible for you to to simply poke across the code and perceive what all of it is doing. However it’s exhausting with a big undertaking, even when you’ve got expertise, to grok all the things about it.
Instance: in case you needed to poke across the code in julienschmidt/httprouter I guess you possibly can perceive 80% of what it does in a comparatively small period of time. However what in case you needed to grasp all of the code in this undertaking?
I do lots of integrations with numerous cloud platforms. Learn by this godoc. That’s only one service and on only one cloud supplier. The place I’m going with that is: with massive initiatives/platforms like this, you just about need to depend on the docs. And often the massive gamers like this have wonderful docs with good examples to observe.
So, I depend on a mixture of documentation and spelunking the code. It actually is dependent upon what I’m engaged on and the packages I’m consuming. In your case, in case you are uncertain about the place to begin, I’d ask the senior developer who’s assigning these duties to you. No one goes to fault you for asking for course (actually, it’s a great behavior to ask for assist if you end up caught!). They WILL fault you for not asking after which not producing something although.
1 Like
Cool, understood. Just about the identical method I feel.
We dumped the Go + Gin factor and began planning for one more enchancment which truly excites me to work on :). Its once more a mix of some database code and writing some Go API’s. Likely, the upcoming week goes to be enjoyable. We shall be planning all the things first and go gradual with it.
Thanks to your assist each of you.