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 service@support.mexc.com 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

Crypto-Fueled Rekt Drinks Sells 1 Millionth Can Amid MoonPay Collab

Crypto-Fueled Rekt Drinks Sells 1 Millionth Can Amid MoonPay Collab

The post Crypto-Fueled Rekt Drinks Sells 1 Millionth Can Amid MoonPay Collab appeared on BitcoinEthereumNews.com. In brief Rekt Brands sold its 1 millionth can of its Rekt Drinks flavored sparkling water. The Web3 firm collaborated with payments infrastructure company MoonPay on a peach-raspberry flavor called “Moon Crush.” Rekt incentivizes purchasers of its drinks with the REKT token, which hit an all-time high market cap of $583 million in August. Web3 consumer firm Rekt Brands sold its 1 millionth can of its Rekt Drinks sparkling water on Friday, surpassing its first major milestone with the sold-out drop of its “Moon Crush” flavor—a peach raspberry-flavored collaboration with payments infrastructure firm MoonPay.  The sale follows Rekt’s previous sellout collaborations with leading Web3 brands like Solana DeFi protocol Jupiter, Ethereum layer-2 network Abstract, and Coinbase’s layer-2 network, Base. Rekt has already worked with a number of crypto-native brands, but says it has been choosy when cultivating collabs. “We have received a large amount of incoming enquiries from some of crypto’s biggest brands, but it’s super important for us to be selective in order to maintain the premium feel of Rekt,” Rekt Brands co-founder and CEO Ovie Faruq told Decrypt.  (Disclosure: Ovie Faruq’s Canary Labs is an investor in DASTAN, the parent company of Decrypt.) “We look to work with brands who are able to form partnerships that we feel are truly strategic to Rekt’s goal of becoming one of the largest global beverage brands,” he added. In particular, Faruq highlighted MoonPay’s role as a “gateway” between non-crypto and crypto users as a reason the collaboration made “perfect sense.”  “We’re thrilled to bring something to life that is both delicious and deeply connected to the crypto community,” MoonPay President Keith Grossman told Decrypt.  Rekt Brands has been bridging the gap between Web3 and the real world with sales of its sparkling water since November 2024. In its first sale,…
Share
BitcoinEthereumNews2025/09/20 09:24