Building a module in Go (Golang)

Learn to build a reusable, well-tested module in Go

4.50 (302 reviews)
Udemy
platform
English
language
Programming Languages
category
instructor
Building a module in Go (Golang)
2,818
students
4 hours
content
Aug 2022
last update
$74.99
regular price

What you will learn

How to build a platform agnostic, re-usable Go module

How to share your module with other Go developers

How to write tests for your module

How to manage multiple versions of your module

How to use Go 1.18's new go work feature, workspaces

Why take this course?

Working with web applications in Go is remarkably easy, but it does not take too long to realize that in a lot of cases, we end up writing the same kind of code every time we start a new project. You might need to read JSON, write JSON, upload files, or any of the commonly used features of a given web application. In other words, we often rewrite code that we have already written, many times over.

Rather than simply copying and pasting code from one project to another, it makes sense to take advantage of Go modules -- reusable code that can be included in a project by simply issuing a "go get" command. That way, if new functionality is added to that module, any project that imports it can take advantage of that functionality simply by updating its dependencies, and if a bug is discovered, you can fix it by updating the module; every project that uses that module gets the bug fix with a single "go get -u" command.

Building a robust, secure, well-tested module is not difficult, but it does require careful planning to ensure that it will work across different operating systems.

This course will take you through the steps necessary to produce a module that includes many of the tasks commonly used in web applications, including:

  • reading JSON

  • writing JSON

  • producing well formatted, informative error messages

  • uploading one or more files to a server, and limiting uploads by mime type and file size

  • creating directories on the server

  • generating random strings

  • downloading static files

  • posting JSON to a remote service

  • creating a URL safe slug from a string

We'll build our module using Go 1.18's new workspaces tools, and we'll ensure that the entire module is well-tested.

Our final module will not have any external dependencies, and will only use functionality found in Go's standard library.

By the time you have finished this course, you'll have a Go module that will make starting a new web application much faster, and you won't be depending on someone else's code to do so.

Reviews

Javier
August 27, 2023
It was a very nice course. I have some suggestions: the second example was a bit long (or complex for me), maybe it should be at the end. In my case, some projects were not easy to understand the objective, it would be nice if at the beginning of each lecture we can got a view or a simple diagram of the functionality. Thanks.
Ubeydullah
August 23, 2023
Content, instructor's knowledge, pace, all are great. I'd recommend the course to all of you out there if that's the kind of content that you are looking for. As for me, it was a bit more advanced than I first thought. I am very new to Go and new to web development, and so it wasn't really possible to follow and understand all of it. But, that is about my level. Thanks for the course!
Philippe
July 4, 2023
Un autre excellent cours de Trevor, tout y est bien détaillé et expliqué. Un excellent professeur qui répond aux questions rapidement. Merci!
Baltan
May 9, 2023
In some ways, it would have been simpler to just have us create all the folders and files in the terminal rather than toggling between the GUI and terminal.
Fred
April 28, 2023
Lecturer is relying on his IDE to insert imports for him; those of us new to go need to know that's happening, especially if we're not using the same IDE.
Peter
April 9, 2023
Another very useful course within the Golang programming series from Trevor Sawler. Once again I found this course very practical, not only from the point of view of handling JSON but other practical aspects such as using workspaces within VS Code and the principle of semantic versioning. The result is a useful module for future projects. A very practical course from an equally practical teacher... highly recommended.
Richard
April 2, 2023
The course starts strong by getting you started with organizing your project in sections 2-3. Then it all pulls together in section 9. The prior sections are there to help reinforce the importance and how to write good tests, but a good listen. I will definitely implement this pattern of creating modules in my future work as it keeps everything clean and separated into individual projects, making things manageable when the code base starts getting large and you work with multiple teams. This course is an excellent addition if you want to learn how to organize your GoLang work for others and your future self to consume.
Jimothy
March 31, 2023
Really loved this approach to teaching Go. Felt like it took me from a place of "knowing go" and pushed me a long way towards actual Go fluency.
Michael
March 5, 2023
The content of the course is nice and the result of having a simple toolkit is good. But it is hard for non-native listeners to follow the videos and writing the code while listen. There should be some more breaks for writing them. Otherwise it will leads to, that all code will be downloaded instead of writing it. And imho it is better if trhe code will be written by very one as self to understand them.
Jürgen
March 5, 2023
I wished there was more background on Go modules, for instance, before Go workspaces have been introduced and afterwards, a bit more about the best practice to structure a project and the use of go commands to deal with modules and packages. There is more focus to create small utilities that are then delivered as part of that module. This is nice for doing some initial steps with Go as you code along with the instructor, but conceptual background is missing. I would find it better, if the instructor left coding the utilities as a challenge for the students, of course giving hints how to solve this in order not to get lost. It is good that the functions added to the module are also covered in a module test. Here again, I'd expect a brief intro to not just code along w/o knowing the details. It is a pity that the instructor doesn't write the tests first before he codes the actual function, as this would teach students the TDD-approach. Overall, the course delivers what I'd expect but I wished more theoretical background was provided.
Tito
February 9, 2023
Scenario for module across the course was explained very well covering different aspects since write module, test it, and creating applications to show fuctionallity
Neeraj
February 8, 2023
Great course overall. Got to learn a lot new go features as well as go modules. Some basic understanding of go is required. Also, at certain places, some explanations regarding why we doing something in a certain way would help !
JP
February 1, 2023
Another recommended course. I really learn eveyrime I follow a couse from '/tsawler'. Well explained with real life solving examples and good peactices (code, publishing to a repo, versionning...). Modules in Go are clear within a few hours from an obvious profesional with experience !
Carlo
January 3, 2023
Really cool course ! The instructor is precise, clear and the course result to be complete and enjoyable. I really recommend this course !
Basil
January 3, 2023
It's an amazing which really focused on the basics of what the title says. I also learned a few things from the code snippets.

Charts

Price

Building a module in Go (Golang) - Price chart

Rating

Building a module in Go (Golang) - Ratings chart

Enrollment distribution

Building a module in Go (Golang) - Distribution chart
4765858
udemy ID
7/4/2022
course created date
8/10/2022
course indexed date
Bot
course submited by