Hello, I'm Ganesh. I'm working on FreeDevTools online, currently building a single platform for all development tools, cheat codes, and TL;DRs — a free, open-source hub where developers can quickly find and use tools without the hassle of searching the internet.
In my previous post, I explained Go's history, why it was created, what problems it solves, and its features.
In this post, I will be explaining the structure of a Go project, how to set it up locally, and how to run it.
So, let's not waste time on installation; you can install it using a single command:
curl -fsSL https://hexmos.com/ipm-install | bash && ipm i golang-go
Structure
This structure consists of the files required to run your code.
Initialize a Go project by creating a go.mod file:
go mod init <project-name>
This will create go.mod. Next, create a main.go file:
my-project/
├── go.mod
├── main.go
└── ...
The go.mod file will contain:
module <project-name>
The first line of go.mod contains the project name. The name should be unique depending on the code hosting provider (e.g., GitHub, GitLab).
This is necessary because Go code can be used in two ways:
-
Executable:
This is when you run the code directly using
go run main.go. - Library (Package): This is when you use the code in other projects by importing it.
You will also see the Go version specified:
go 1.23
This indicates the Go version used to run the project.
First Go Program
main.go
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Run the code above with:
go run main.go
In Next Post
We will be leanring by actually checking few open source projects for better understanding.
I’ve been building for FreeDevTools.
A collection of UI/UX-focused tools crafted to simplify workflows, save time, and reduce friction when searching for tools and materials.
Any feedback or contributions are welcome!
It’s online, open-source, and ready for anyone to use.
👉 Check it out: FreeDevTools
⭐ Star it on GitHub: freedevtools

Top comments (0)