DEV Community


Explain setting up a Golang Dev Environment Like I'm Five

Kyle Morton
Web Stuffs and Server Stuffs and Automation Stuffs
・2 min read

I cannot for the life of me find any consistent, standardized, up-to-date methodology or organization for starting, maintaining, or importing projects.

  • What's your dev environment look like?
  • What's your tooling look like?
  • What does your file structure look like?
  • Do you use a "main.go"?
  • Do you have one master folder for all your go projects?

One of the biggest hindrances I've experienced trying to get into Golang is simply starting to code.

Python is easy enough to set up and zombify scripts that serve my purpose

JavaScript is easy enough to incorporate into HTML.

Node.JS is simple enough to get basic apps running/listening on port 3000.

Why is it so difficult (for me, at least) to get a simple golang project started?

Here's where I'm at now:

using Vagrant to host ubuntu 2004 locally, and using VSCode to SSH into it locally.

I've got go bin installed (/usr/local/go)
I've got that location added to my $PATH.
I have $GOPATH configured to /home/vagrant/go
I have $GOPATH/bin also added to my $PATH.

structure of /home/vagrant/go


Is there an "initiate" or "initialize" command within Go to create additional structure from here?

If I end up using the structure to build out my project, does that repository need to already exist?

Is there any SOP's for this? any documentation I should read or community space I should involve myself in that discusses this kind of thing?

Sorry, lot's of data and questions here, but jeeeeeze. I love the idea of Golang, and have attempted to start learning it several times, and each time, I get stuck at the stupidest part: setting up my dev environment.

WHY!? (oh how I wish the Interrobang was a thing)

Discussion (2)

leventel profile image
Levente Laszlo

Hey, did you try this guide ?

hariprasadraja profile image

Create a main.go file in your GOPATH and run it. If it does, then move the file to directory and start treating it as a project.