<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-use-go-modules-661ezgkbc" -->

---
title: How to Use Go Modules | daily.dev
description: A comprehensive guide to Go modules covering the full dependency management workflow. Topics include creating a module with go mod init, adding sub-packages,...
canonical: https://daily.dev/posts/how-to-use-go-modules-661ezgkbc
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Use Go Modules | daily.dev
og:description: A comprehensive guide to Go modules covering the full dependency management workflow. Topics include creating a module with go mod init, adding sub-packages,...
og:url: https://daily.dev/posts/how-to-use-go-modules-661ezgkbc
og:image: https://api.daily.dev/og/posts/661ezgkBC.png
og:image:alt: How to Use Go Modules
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Use Go Modules

**[DigitalOcean Community](https://daily.dev/sources/do_community)** · 36 min read · 10 upvotes · 0 comments

## Summary

A comprehensive guide to Go modules covering the full dependency management workflow. Topics include creating a module with go mod init, adding sub-packages, using go get to add remote dependencies, referencing specific versions via tags, branches, and commit hashes, and running go mod tidy. Also covers advanced topics: Go workspaces (go work) for multi-module development introduced in Go 1.18, the replace directive for local development and forks, configuring GOPROXY and GOPRIVATE for private module access, and how go get behavior evolved from Go 1.15 through 1.21 with the separation of go get (dependency management) and go install (binary installation).

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.digitalocean.com/community/tutorials/how-to-use-go-modules>

## Similar posts on daily.dev

- [The Two Files Every Go Developer Ignores Until Production: go.mod and go.sum](https://daily.dev/posts/the-two-files-every-go-developer-ignores-until-production-go-mod-and-go-sum-seyuluzyb) · Medium · 2 upvotes · 0 comments
- [How To Install Go on Ubuntu](https://daily.dev/posts/how-to-install-go-on-ubuntu-snjoxgjzg) · DigitalOcean Community · 0 upvotes · 0 comments
- [How to Get Started Coding in Golang](https://daily.dev/posts/how-to-get-started-coding-in-golang-6wbhpagp8) · freeCodeCamp · 13 upvotes · 0 comments
- [go.sum Is Not a Lockfile](https://daily.dev/posts/go-sum-is-not-a-lockfile-94jlokvk7) · Filippo Valsorda · 15 upvotes · 0 comments
- [What's new in git-pkgs](https://daily.dev/posts/what-s-new-in-git-pkgs-emtpxalx0) · Andrew Nesbitt · 0 upvotes · 0 comments

---

Tags: [#golang](https://daily.dev/tags/golang)

[View this post on daily.dev](https://daily.dev/posts/how-to-use-go-modules-661ezgkbc)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Use Go Modules","url":"https://daily.dev/posts/how-to-use-go-modules-661ezgkbc","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-use-go-modules-661ezgkbc"},"datePublished":"2026-04-01T15:13:07.520Z","dateModified":"2026-04-01T15:13:37.803Z","description":"A comprehensive guide to Go modules covering the full dependency management workflow. Topics include creating a module with go mod init, adding sub-packages,...","image":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","thumbnailUrl":"https://media.daily.dev/image/upload/s--0_ODbtD2--/f_auto/v1722860399/public/Placeholder%2008","isAccessibleForFree":true,"articleSection":"DigitalOcean Community","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DigitalOcean Community","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/c1b9d07730e34ea388c39a498a753d6c","url":"https://daily.dev/sources/do_community"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-use-go-modules-661ezgkbc","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":10},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"golang","timeRequired":"PT36M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DigitalOcean Community","item":"https://daily.dev/sources/do_community"},{"@type":"ListItem","position":3,"name":"How to Use Go Modules"}]}
```

