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

Go Project Templates: How to Get Started

2025/09/21 00:00

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

Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact [email protected] for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

ECB's Lagarde warns of persistent economic uncertainty despite recent progress

ECB's Lagarde warns of persistent economic uncertainty despite recent progress

The ECB has reached its goal of keeping inflation at 2%.
Share
Cryptopolitan2025/09/20 21:17
MoonBull, Toncoin & ETH Gains

MoonBull, Toncoin & ETH Gains

The post MoonBull, Toncoin & ETH Gains appeared on BitcoinEthereumNews.com. Crypto Presales MoonBull, Toncoin, and Ethereum are trending coins. Join MoonBull presale now, the best coins to buy in 2025 for early investor rewards! Have you ever wondered which altcoins could deliver massive gains in 2025? With cryptocurrencies evolving faster than ever, investors are hunting for coins that can outperform the market while offering early advantages. Toncoin and Ethereum have been making waves with adoption and ecosystem developments, drawing attention from traders and blockchain enthusiasts alike. Among the best coins to buy in 2025, MoonBull is turning heads with its active presale stage and massive upside potential. Stage 6 of the MoonBull presale is live, offering investors a rare first-come, first-served opportunity to secure tokens at the lowest prices. For those looking to jump into a trending coin that combines meme-coin energy with real-world utility, MoonBull offers a compelling option. MoonBull Presale Stage 6: Don’t Miss the Opportunity to Best Coins to Buy Now MoonBull ($MOBU), one of the best coins to buy in 2025, is setting the stage for a potential breakout, making it one of the most exciting coins in the market. With Stage 6 live at $0.00008388, early investors are positioned at the ground floor, securing tokens before demand surges across 23 stages. The presale tally has already surpassed $550K, and over 1,900 investors are holding $MOBU, creating significant buzz. Early participants have seen an ROI of 235.52%, while Stage 6 listing projects a jaw-dropping 7,244% potential. A $100 investment in Stage 6 of the MoonBull presale would secure approximately 1,192,179 tokens at the current price of $0.00008388 per token. If MoonBull reaches its estimated listing price of $0.00616, those tokens could be worth around $7,343.82 at launch. This potential transformation of a small investment into thousands of dollars underscores why MoonBull’s presale is attracting strong early…
Share
BitcoinEthereumNews2025/11/09 16:17