We may earn an affiliate commission when you visit our partners.
Trevor Sawler

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.

Read more

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.

Enroll now

Here's a deal for you

We found an offer that may be relevant to this course.
Save money when you learn. All coupon codes, vouchers, and discounts are applied automatically unless otherwise noted.

What's inside

Learning objectives

  • 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

Syllabus

Introduction
About me
How to ask for help
Project Setup
Read more

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses Go 1.18's workspaces feature, which allows developers to work on multiple modules at the same time, streamlining development and testing
Focuses on building a module without external dependencies, which promotes code reliability and reduces potential conflicts with other libraries
Covers semantic versioning and module tagging, which are essential skills for managing and distributing Go modules effectively
Teaches how to create a URL-safe slug from a string, which is useful for creating clean and SEO-friendly URLs in web applications
Emphasizes writing tests for each function in the module, which promotes good coding practices and ensures the module's reliability
Demonstrates how to upload files to a server, limiting uploads by mime type and file size, which is a common requirement for web applications

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Practical go module building

According to learners, this course is a very practical and hands-on guide to building reusable Go modules, focusing exclusively on the Go standard library. Students found the content immediately applicable to real-world web development tasks. The course is particularly praised for its thorough coverage of testing, versioning, and the use of the `go work` feature. The instructor is highly regarded as knowledgeable, clear, and responsive. While the course is considered concise and packed with information, some reviewers felt it might move too quickly for absolute beginners and occasionally assumes prior knowledge. There were minor suggestions for deeper dives into topics like error handling or adding more complex, integrated examples. Overall, it's seen as an outstanding resource for intermediate to advanced Go developers looking to formalize their module-building skills using only standard tools.
Suggestions for deeper topics or more examples.
"I think some topics like error handling or middleware could be explored a bit more deeply."
"it could benefit from maybe one slightly larger, integrated project example demonstrating how multiple module functions work together..."
"error handling within the module functions could have been more robustly discussed or demonstrated."
Instructor is knowledgeable and helpful.
"the instructor has been responsive on the Q&A and has addressed issues that came up."
"Instructor is top notch."
"The instructor is knowledgeable and the course is well-structured."
"Instructor knows his stuff and explains complex topics simply."
Testing modules is covered effectively.
"It covers testing, versioning, and explains the 'go work' feature very clearly."
"Testing and versioning are well covered."
"The testing part is crucial and well explained."
"Testing coverage was excellent."
Content is hands-on and immediately useful.
"Great course. Very practical, hands on, and immediately applicable content."
"The hands-on approach with practical examples makes learning effective."
"The examples are relevant to real-world web development tasks."
"Packed with practical knowledge and immediately useful code."
Utilizes only Go's built-in functionality.
"teaches you how to build a robust and production-ready library using Go's standard library."
"Excellent course that delivers exactly what it promises: building a useful, reusable Go module using only the standard library."
"Using only the standard library is a big plus. The testing part is crucial and well explained."
"The standard library approach is commendable."
Pace may be fast for absolute beginners.
"While this course may not be for the very beginner, for intermediate to advanced Go developers this course is very well done..."
"sometimes the explanations feel a little brief, assuming prior knowledge."
"Solid course... My only minor criticism is that sometimes the explanations feel a little brief, assuming prior knowledge."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Building a module in Go (Golang) with these activities:
Review Go Fundamentals
Solidify your understanding of Go fundamentals before diving into module creation. This will make grasping the more advanced concepts easier.
Show steps
  • Review basic syntax and data types.
  • Practice writing simple Go programs.
  • Familiarize yourself with Go's standard library.
Build a Simple CLI Tool
Practice building a command-line tool using Go to reinforce your understanding of package management and module structure. This will help you apply the concepts learned in the course.
Show steps
  • Define the functionality of your CLI tool.
  • Create a new Go module for your project.
  • Implement the core logic of your tool.
  • Add error handling and input validation.
  • Test your CLI tool thoroughly.
Read 'The Go Programming Language'
Deepen your understanding of Go with a comprehensive guide. This book provides a solid foundation for building robust Go modules.
Show steps
  • Read the chapters relevant to module creation.
  • Experiment with the code examples provided.
  • Take notes on key concepts and best practices.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Write a Blog Post on Go Modules
Solidify your knowledge by explaining Go modules to others. Writing a blog post forces you to organize your thoughts and clarify any remaining uncertainties.
Show steps
  • Choose a specific aspect of Go modules to focus on.
  • Research and gather information on your chosen topic.
  • Write a clear and concise blog post.
  • Include code examples and illustrations.
  • Proofread and edit your post before publishing.
Read 'Go in Action'
Explore practical applications of Go with a hands-on guide. This book complements the course by showcasing real-world examples and use cases.
View Go in Action on Amazon
Show steps
  • Read the chapters that align with your interests.
  • Try out the code examples and adapt them to your own projects.
  • Reflect on how the concepts apply to your work.
Contribute to a Go Project
Gain practical experience by contributing to an open-source Go project. This will expose you to real-world codebases and collaborative development workflows.
Show steps
  • Find an open-source Go project that interests you.
  • Browse the project's issue tracker for beginner-friendly tasks.
  • Fork the repository and create a new branch for your changes.
  • Implement your solution and submit a pull request.
  • Respond to feedback and revise your code as needed.
Create a Go Module Template
Develop a reusable Go module template to streamline future projects. This will reinforce your understanding of module structure and best practices.
Show steps
  • Define the core components of your template.
  • Create a well-structured directory layout.
  • Include essential files like go.mod and README.md.
  • Add placeholder code for common functionalities.
  • Document your template thoroughly.

Career center

Learners who complete Building a module in Go (Golang) will develop knowledge and skills that may be useful to these careers:
Backend Developer
A Backend Developer is responsible for the server-side logic and database interactions of web applications. This course on building a module in Go directly applies to the work of a Backend Developer by teaching how to create reusable modules for common tasks like reading and writing JSON, handling file uploads, creating directories, and posting data to remote services. Understanding how to build robust and tested modules in Go allows a Backend Developer to develop more efficient, scalable, and maintainable web applications. The skills this course provides are helpful for building core server side application components efficiently.
Software Engineer
A Software Engineer designs, develops, and maintains software systems. This course is helpful for a Software Engineer because it covers the creation of a reusable module in Go, which is a fundamental aspect of software engineering. By learning how to build a well-tested module to handle tasks such as managing file uploads, working with JSON, and producing error messages, a Software Engineer can develop larger systems more efficiently. This course is especially relevant for those working with web application development. The course emphasizes test-driven development and version control using GitHub which are all extremely vital for Software Engineers.
API Developer
An API Developer specializes in creating and maintaining Application Programming Interfaces (APIs) that allow different software systems to communicate with each other. This course is particularly useful for an API Developer because it covers essential skills for building efficient APIs, especially with its focus on handling JSON data, creating URL safe strings, and posting data to remote services. The course's emphasis on producing informative error messages and working with Go's standard library also directly translates to the work of an API Developer. Additionally the course helps build a foundation for building stable versioned software modules.
Web Application Developer
A Web Application Developer creates interactive web applications that users access through browsers. This course helps a Web Application Developer by teaching how to build a reusable Go module, which makes development faster and more efficient. This module provides commonly used web application functionality such as reading/writing JSON, uploading files, and creating directories. This course provides a specific toolkit that a Web Application Developer can use to build new projects quickly; the course also emphasizes the importance of writing tests for all functions such as error handling thus minimizing bugs. It would be useful for any web application developer who builds with Go.
DevOps Engineer
A DevOps Engineer works to automate and optimize the software development lifecycle. A DevOps Engineer can use this course to better understand how to create maintainable and reusable packages. Creating modules in Go, as this course demonstrates, can make a DevOps Engineer's job easier, since these modules can be easily reused across different projects. Additionally, the course's emphasis on testing and version control are critical skills for a DevOps engineer who is concerned with shipping reliable and stable software. Since this course emphasizes building a modular package, it may be useful for DevOps engineers looking to create their own custom solutions.
Solutions Architect
A Solutions Architect designs and oversees the implementation of complex software and hardware systems. While this role is broader than just web application development, this course may be helpful for a Solutions Architect who wishes to understand the practical aspects of building reusable components in a modern web application. The course's focus on creating platform-agnostic modules and managing versioning can help a Solutions Architect make better architectural decisions. Especially if they are involved in projects that use Go, the course helps ensure they will have a good understanding of the lower level implementations.
Cloud Engineer
A Cloud Engineer focuses on managing cloud-based infrastructure and services. This course may be useful for a Cloud Engineer, particularly if they work with Go in their environment. The course will help a Cloud Engineer to understand the creation of reusable modules which is beneficial when automating cloud infrastructure. The skills taught in this course, such as how to handle file uploads and interact with remote services, are relevant for building various cloud applications and services. The course also covers versioning and testing, which are very important in cloud based environments.
Systems Engineer
A Systems Engineer is involved in the design, management, and maintenance of an organization's technology infrastructure. This course may be useful for a Systems Engineer who needs to understand how custom applications are built. The ability to create reusable packages that handle common tasks, that is the subject of this course, is valuable when deploying and maintaining systems. The skills developed in this course, such as building modules that read and write JSON, may also help Systems Engineers as they automate routine tasks.
Technical Lead
A Technical Lead guides a team of developers, makes architectural decisions, and ensures the quality of the final product. This course may be useful for a Technical Lead, especially if their team uses Go. The course helps a Technical Lead understand good practices for building and testing reusable modules in Go. By understanding the material in this course the Technical lead can make design decisions for the rest of his team. By understanding the specific tooling and testing frameworks, the Technical Lead can also better mentor other engineers on the team.
Software Architect
A Software Architect defines the high-level design of software systems and ensures alignment with business goals. This course may be useful for a Software Architect who desires to understand the practical implementation details of creating reusable modules in Go. This understanding is beneficial when making critical architectural trade-offs since the course emphasizes modularity and reusability. The concepts discussed in this course, specifically around maintainability and testing, are crucial in larger software architecture projects.
Mobile Application Developer
A Mobile Application Developer creates applications for mobile devices. While this course focuses on server-side development with Go, some Mobile Application Developers build the backends for their mobile apps. The skills taught in the course may be helpful for them, since it covers how to read and write JSON, upload files, and securely communicate with a server, all of which are often used in conjunction with a mobile application. A mobile developer who takes this course can build their own robust backend with Go.
Data Engineer
A Data Engineer is involved in building and maintaining the infrastructure that enables data analysis. While this course does not directly cover data engineering, it may be useful for the Data Engineer who needs to build custom tools for data processing, as the course helps them use Go efficiently. The module that is built in the course has methods for reading and writing JSON which is fundamental to data processing pipelines. Furthermore the course's focus on reusable code can aid Data Engineers in creating modular and maintainable data processing systems. However, this is not the primary focus of the role.
Technical Writer
A Technical Writer creates documentation for software and hardware products. This course may be useful for a Technical Writer who wants to better understand the technology behind Go modules. This course will provide specific hands-on experience that will allow the writer to better understand the technologies being used; this can lead to more accurate and more informative documentation. Even though this role is not directly involved with software creation the technical knowledge would be beneficial.
Database Administrator
A Database Administrator is responsible for the maintenance and performance of databases. This course may be useful for a Database Administrator, particularly if their work involves interacting with APIs built with Go. The course's modules for reading and writing JSON, as well as its instruction on interacting with remote services, are applicable when working with databases. However, it is likely not directly relevant to the more technical tasks such as database setup and query optimization that are more typical for a database administrator.
Project Manager
A Project Manager is responsible for planning, executing, and closing projects. This course may be helpful for Project Managers who wish to better understand software development practices, especially with Go. While there are skills taught in this course that may be useful to a project manager, this course is not a typical step for project managers. However, project managers who wish to have a better understanding of the development process may find it helpful.

Reading list

We've selected two books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Building a module in Go (Golang).
Comprehensive guide to the Go programming language. It covers everything from the basics to advanced topics, making it an excellent resource for both beginners and experienced programmers. It provides a deeper understanding of the language's features and best practices. This book is commonly used as a textbook at academic institutions.
Provides a practical, hands-on approach to learning Go. It covers a wide range of topics, including concurrency, testing, and networking. It is particularly useful for developers who want to apply Go to real-world problems. This book is more valuable as additional reading than it is as a current reference.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser