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

시장 기회
GET 로고
GET 가격(GET)
$0.00268
$0.00268$0.00268
+47.25%
USD
GET (GET) 실시간 가격 차트
면책 조항: 본 사이트에 재게시된 글들은 공개 플랫폼에서 가져온 것으로 정보 제공 목적으로만 제공됩니다. 이는 반드시 MEXC의 견해를 반영하는 것은 아닙니다. 모든 권리는 원저자에게 있습니다. 제3자의 권리를 침해하는 콘텐츠가 있다고 판단될 경우, service@support.mexc.com으로 연락하여 삭제 요청을 해주시기 바랍니다. MEXC는 콘텐츠의 정확성, 완전성 또는 시의적절성에 대해 어떠한 보증도 하지 않으며, 제공된 정보에 기반하여 취해진 어떠한 조치에 대해서도 책임을 지지 않습니다. 본 콘텐츠는 금융, 법률 또는 기타 전문적인 조언을 구성하지 않으며, MEXC의 추천이나 보증으로 간주되어서는 안 됩니다.

추천 콘텐츠

Why IPO Genie ($IPO) Is Being Called a Top Crypto Presale by Analysts

Why IPO Genie ($IPO) Is Being Called a Top Crypto Presale by Analysts

IPO Genie ($IPO) is being called a top crypto presale by analysts, offering AI-driven market insights, robust tokenomics, and data-backed investor growth.
공유하기
Blockchainreporter2025/12/18 22:00
PEPE Price Struggles Near Resistance, Breakout Could Ignite $0.0000090 Surge

PEPE Price Struggles Near Resistance, Breakout Could Ignite $0.0000090 Surge

Pepe (PEPE) traded around $0.00000384 as it dropped by 12.77% during the week, with a 5.24% decline in market cap to approximately $1.62 billion. The setback follows
공유하기
Tronweekly2025/12/18 22:00
Spain National Team Top FIFA World Rankings In Men’s And Women’s Soccer

Spain National Team Top FIFA World Rankings In Men’s And Women’s Soccer

The post Spain National Team Top FIFA World Rankings In Men’s And Women’s Soccer appeared on BitcoinEthereumNews.com. SYDNEY, AUSTRALIA – 2023/08/20: (L-R) Alexia Putellas, Jennifer Hermoso and Irene Paredes of Spain celebrate after winning the Women’s World Cup 2023 Final game between Spain and England at Accor Stadium. Final scores, Spain 1:0 England. (Photo by Julieta Ferrario/SOPA Images/LightRocket via Getty Images) SOPA Images/LightRocket via Getty Images The Spanish National Team has today become the first in a decade to top the FIFA World Rankings in both the men’s and women’s game. Not since 2015 has one country held the number one position in the senior men’s and women’s game. The respective Spanish national teams have both assumed pole position in the charts following the release of the latest charts. The women’s national team are the current world champions and holders of the UEFA Women’s Nations League. This summer, they also reached the final of the UEFA Women’s Euro but lost out to reigning European champions England in a dramatic penalty shoot-out. BASEL, SWITZERLAND – JULY 27: England players applaud Aitana Bonmati of Spain as she makes her way forward to collect her player of the tournament award following during the UEFA Women’s EURO 2025 Final match between England and Spain at St. Jakob-Park on July 27, 2025 in Basel, Switzerland. (Photo by Jonathan Moscrop/Getty Images) Getty Images Nonetheless, they remained unbeaten throughout the tournament in regulation time and these results, coupled with them finishing above England in the latest edition of the Nations League group stage, were sufficient for them to overhaul the reigning Olympic champions, the United States, at the top of the women’s world rankings. The Spanish men’s team are the reigning European champions. Last summer, they became the first team in the competition’s history to win seven successive matches at a single tournament as they swept aside three former world champions – Germany, France…
공유하기
BitcoinEthereumNews2025/09/18 20:59