Course Information
Course Overview
Learn to build a reusable, well-tested module in Go
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.
Course Content
- 10 section(s)
- 58 lecture(s)
- Section 1 Introduction
- Section 2 Project Setup
- Section 3 Getting Started with the Module
- Section 4 Uploading one or More Files
- Section 5 Creating Directories if they do not exist
- Section 6 Generating Slugs
- Section 7 Downloading a Static File
- Section 8 Working with JSON
- Section 9 Tagging a release & Semantic Versioning
- Section 10 Trying our module out
What You’ll 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
Skills covered in this course
Reviews
-
TTimothy Boudreau
A good introduction to creating Go modules with simple examples that includes guidance on publishing repository versioning. By the end of the course I had successfully created my own Go module, published it, and imported it into a new project. -- Thanks Dr. Sawler, your courses are always a pleasure and, though some may not, I appreciate the dedicated time you give to writing testing and consistently updating them. Too often in my teams I see this being overlooked as an afterthought or as a separate task, but the way you incorporate that flow into every feature for your courses is how we should all operate as professional programmers.
-
AAdam Stern
I think the instructor excells in shorter courses like this one. Overall I got about what I expected. A only semi-complaint I have is that I would have appreciated if the instructor would have gone into more details about some of the subjects we used throughout the course like JSON files, basics of website development, etc. I don't expect a fully fledge explanation that would make me a pro in those subjects but just a basic explanation so I can understand what we made. Afterall they weren't listed in the requirements for this course and it will be easier to utilize this module when we have a basic understandings of the things that utilize it.
-
AAndreas Kaudel
Thank you very much !
-
MMatias Ezequiel Filsti
poor approach to modules. It should have focused on different ways to create modules, structures, module mock and not so much on its application. loses the focus of the course.