Go Project Templates: How to Get Started

Anyone can write templates, which are packaged and distributed as modules, leveraging the Go module proxy and checksum database for better security and availability.


This content originally appeared on HackerNoon and was authored by Go [Technical Documentation]

When you start a new project in Go, you might begin by cloning an existing project. That way, you can start with something that already works, making incremental changes instead of starting from scratch.

\ For a long time now, we have heard from Go developers that getting started is often the hardest part. New developers coming from other languages expect guidance on a default project layout, experienced developers working on teams expect consistency in their projects’ dependencies, and developers of all kinds expect an easy way to try new products and services without having to copy and paste from samples on the web.

\ To that end, today we published gonew, an experimental tool for instantiating new projects in Go from predefined templates. Anyone can write templates, which are packaged and distributed as modules, leveraging the Go module proxy and checksum database for better security and availability.

\ The prototype gonew is intentionally minimal: what we have released today is an extremely limited prototype meant to provide a base from which we can gather feedback and community direction. Try it out, tell us what you think, and help us build a more useful tool for everyone.

Getting started

Start by installing gonew using go install:

$ go install golang.org/x/tools/cmd/gonew@latest

\ To copy an existing template, run gonew in your new project’s parent directory with two arguments: first, the path to the template you wish to copy, and second, the module name of the project you are creating. For example:

$ gonew golang.org/x/example/helloserver example.com/myserver
$ cd ./myserver

\ And then you can read and edit the files in ./myserver to customize.

\ We’ve written two templates to get you started:

  • hello: A command line tool that prints a greeting, with customization flags.
  • helloserver: An HTTP server that serves greetings.

Write your own templates

Writing your own template is as easy as creating any other module in Go. Check out the examples we linked above to get started.

\ There are also examples available from the Google Cloud and Service Weaver teams.

Next steps

Please try out gonew and let us know how we can make it better and more useful. Remember, gonew is just an experiment for now; we need your feedback to get it right.


Cameron Balahan

\ This article is available on The Go Blog under a CC BY 4.0 DEED license.

\ Photo by Clemens van Lay on Unsplash


This content originally appeared on HackerNoon and was authored by Go [Technical Documentation]


Print Share Comment Cite Upload Translate Updates
APA

Go [Technical Documentation] | Sciencx (2025-09-20T16:00:05+00:00) Go Project Templates: How to Get Started. Retrieved from https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/

MLA
" » Go Project Templates: How to Get Started." Go [Technical Documentation] | Sciencx - Saturday September 20, 2025, https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/
HARVARD
Go [Technical Documentation] | Sciencx Saturday September 20, 2025 » Go Project Templates: How to Get Started., viewed ,<https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/>
VANCOUVER
Go [Technical Documentation] | Sciencx - » Go Project Templates: How to Get Started. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/
CHICAGO
" » Go Project Templates: How to Get Started." Go [Technical Documentation] | Sciencx - Accessed . https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/
IEEE
" » Go Project Templates: How to Get Started." Go [Technical Documentation] | Sciencx [Online]. Available: https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/. [Accessed: ]
rf:citation
» Go Project Templates: How to Get Started | Go [Technical Documentation] | Sciencx | https://www.scien.cx/2025/09/20/go-project-templates-how-to-get-started/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.