GO & RAYLIB ~ Get Setup
This is a post in the
go_games series.
Other posts in this series:
- Nov 21, 2025 - GO & RAYLIB ~ Get Setup
- Nov 24, 2025 - Short Note
POST UPDATED : 2025-11-21
Intro
This tutorial we will setup your Raylib-go dev environment and create a project which will produce a blank window. In a Windows 11 environment. The setup on Linux and Mac are well described on the raylib site. Windows requires extra effort to set up a C compiler but has a very simple method of using the raylib-dll. We will use this method to get you started as quickly as possible.
Requirements
- You need Go installed ~ the newest version is often a good idea, then stick with that untill you are comfortable. You can get it from GO.DEV downloads
- Git from Git-scm.com/downloads
- A text editor or an IDE. VSCode, Goland, Notepad
What experience has shown me
- Git is essential. Yes for version control, BUT mostly helps you NOT to loose all your code.
- Writing Tests is more important than you think and does save time. Weirdly and automatically you write manageable code.
- Learning a new computer language is not difficult but not simple either. (similarities trip you up - often)
I have a few useful links at the end of each post.
Note: I have watched a lot of C or C++ raylib tutorials and use the info to help build the same thing in Go.
Install Go & Git
- Go to GO.DEV downloads follow the instructions to download and install for your system.
- get Git from Git-scm.com downloads. Download and install.
- install VSCode with the Go extension - you need to search for the extension from within the vscode application
- The Raylib dll from the Raylib Releases Page. Get one of the Win64 zip files from the 5.5 or higher release and extract. the dll will be in one of the folders.
Note:
I find VSCode can get in the way as it tries to Help too much. It is a decent free IDE, and with the Go plugin it is not bad with its code completion
Create a new prject folder
I often create a Dev (develop/projects/whatever) folder under my HOME folder and place my projects in there.
In your Dev folder:
- create a folder called mygame you can use file explorer.
- go into that folder and create a file and rename it to main.go (Windows folders in File Explorer require the extentions to be on. View/Show/enable file extentions)
Here are the CMD (command line) instructions. Run from the home directory
mkdir Dev
cd Dev
mkdir mygame
cd mygame
echo "" > main.go
From now on commands are run from the ‘project’ folder we called mygame
NOTE:
Linux and macOS users would use cat not echo.
They would use thier terminal app not cmd.
AND:
Windows has a new Terminal and a new Powershell (7 I think)
They are useful and can be found in the microsoft store.

using a text editor like notepad or IDE like VSCode
- edit main.go and add the following (remove "" if its at the top of the file)
package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}
We can run this short app using this terminal command
go run hello.go

Go uses mod files to tell the go compiler what files it needs. i.e. project stuff
go mod init example.com/mygame
go mod tidy
go build .

running the new exe will produce the same output
Lets start using Git.
and initialize our git repository and make an initial commit
git init
git add .
git commit -m "initial commit"

To see the .git folder you need to view hidden items the same way we showed extentions earlier.
Add a Global User Name and email - so you dont need to specify every repository (just yet)
Use your name or company name or alias Use your email or a hidden one (online git site like github provides them for security)
git config --global user.name "My Name"
git config --global user.email "myemail@example.com"
You also may need to learn about connecting your repository to a service like GitHub or BitBucket. To do that go to one of the sites and create an account then follow instructions on how to connect it to your repository (The Git in VS Code also gives ways to do it).
Install Raylib
Windows NO cgo instructions:
We will use cgo another time, for now download raylib if not already.
-
click on the release title (i.e. RayLib 5.5 takes you to https://github.com/raysan5/raylib/releases/tag/5.5)
-
scroll down to the bottom of the page and select the zip file for your system

- Download the file
- open it (windows can look in zip files)
- go ito the various folders until you find the raylib.dll file

extract it and copy it to top level (root folder) of your project i.e. mygame folder

Now type the following (this always give the latest release, but you can specify a version or allow go mod tidy to do it for you)
go get github.com/gen2brain/raylib-go/raylib
This will add a pkg folder with the required files in their respective folders

now replace the contents of main.go with the following
package main
import rl "github.com/gen2brain/raylib-go/raylib"
func main() {
rl.InitWindow(800, 450, "raylib [core] example - basic window")
defer rl.CloseWindow()
rl.SetTargetFPS(60)
for !rl.WindowShouldClose() {
rl.BeginDrawing()
rl.ClearBackground(rl.RayWhite)
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LightGray)
rl.EndDrawing()
}
}
We need to fix the mod file and rebuild
go mod tidy
go build .

If you get the same results - congrats
if not check the instructions and requirements on the raylib-go site again. Still stuck try the 1st and 2nd videos from the series below
Links
A Video series to build a Animal Crossing style game
Mostly I start with these sites
To Learn Go
- go.dev. The Learn and Docs sections are useful.
- Interactive tour of GO
- [Exercism] (https://exercism.org/tracks/go) for learning computer languages
Useful sites for Game dev
- awesome-go.com follow the game-development link
- raylib-go
- Raylib itself choose your platform
Some Games
- A Video series to build a Animal Crossing style game
- My tetris GO project - the original C project tutorial with sounds etc.
- tetris - a raylib example