← All extensions

Go Snippets

v0.1.5 · by Ayberk Gezer · added 3 November 2026

Go snippets for Zed IDE. A collection of go snippets to improve your development speed.

Snippets

How to install

With Forge Super installed, the button above opens the app on this extension, where you press Install. Nothing is installed until you do.

You can also open the Extensions panel in the app and search for Go Snippets. The extension's id is go-snippets.

Don't have Forge Super yet? Download it here.

README

From the extension's repository, written by its authors and not by Mentenaz. See the source.

Go Snippets for Zed IDE

A collection of Go snippets for the Zed IDE to improve your development speed and productivity.

Features

This extension provides a comprehensive set of snippets for Go development, including:

  • Package and import declarations
  • Control structures (if, for, switch)
  • Function and method declarations
  • Common Go patterns
  • HTTP server code
  • Testing helpers
  • Template snippets
  • And much more!

Installation

Method 1

  1. Go to Extensions menu in Zed IDE
  2. Search for "go-snippets"
  3. Click "Install"

Method 2

  1. Clone this repo:
git clone https://github.com/ayberkgezer/go-zed-snippets.git
  1. Go to Extensions menu in Zed IDE
  2. Click "Install Dev Extension"
  3. Select the folder you cloned

Usage

Start typing the snippet prefix (e.g., go-func) in a Go file and press Tab to expand the snippet.

Available Snippets

PrefixDescription
go-imSingle import statement
go-imsMultiple import block
go-coSingle constant
go-cosMultiple constants block
go-tyfType function declaration
go-tyiType interface declaration
go-tysType struct declaration
go-pkgmPackage main with main function
go-funcFunction declaration
go-varSingle variable declaration
go-varsMultiple variables block
go-switchSwitch statement
go-selSelect statement
go-csCase clause
go-forFor loop
go-forrFor range loop
go-chChannel declaration
go-mapMap declaration
go-inEmpty interface
go-ifIf statement
go-elElse branch
go-ieIf-else statement
go-iferrIf error check
go-fpfmt.Println()
go-fffmt.Printf()
go-lplog.Println()
go-lflog.Printf()
go-lvLog variable content
go-tlt.Log() for tests
go-tlft.Logf() for tests
go-tlvLog variable in tests
go-makemake() statement
go-newnew() statement
go-pnpanic()
go-wrHTTP handler parameters
go-hfhttp.HandleFunc()
go-handHTTP handler declaration
go-rdhttp.Redirect()
go-herrhttp.Error()
go-lashttp.ListenAndServe()
go-svhttp.Serve()
go-goAnonymous goroutine
go-gfGoroutine function call
go-dfDefer statement
go-tfTest function
go-tmTestMain function
go-bfBenchmark function
go-efExample function
go-tdtTable-driven test
go-finitinit function
go-fmainmain function
go-methMethod declaration
go-hellowebHello world web app
go-sortSort implementation
go-tblock{{ block "name" pipeline }}
go-tblockend{{ block "name" pipeline }} ... {{ end }}
go-tbreak{{ break }}
go-tcontinue{{ continue }}
go-tdefine{{ define "name" }}
go-tdefineend{{ define "name" }} ... {{ end }}
go-telse{{ else }}
go-telseif{{ else if (condition) }}
go-tend{{ end }}
go-tif{{ if (condition) }}
go-tifend{{ if (condition) }} ... {{ end }}
go-tifelseend{{ if (condition) }} ... {{ else }} ... {{ end }}
go-tpartial{{ partial "name" }}
go-tpipeline{{ pipeline }}
go-trange{{ range pipeline }}
go-trangeend{{ range pipeline }} ... {{ end }}
go-ttemplate{{ template "name" pipeline }}
go-twith{{ with pipeline }}
go-twithend{{ with pipeline }} ... {{ end }}
go-twithelseend{{ with pipeline }} ... {{ else }} ... {{ end }}
go-twithelsepipeeend{{ with pipeline }} ... {{ else with pipeline }} ... {{ end }}

Examples

Function declaration

Type go-func and press Tab:

func name(param type) returnType {
    // Your code here
}

If error check

Type go-iferr and press Tab:

if err != nil {
    return nil, err
}

HTTP handler

Type go-hand and press Tab:

func handlerName(w http.ResponseWriter, r *http.Request) {
    // Your code here
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Author

Ayberk Gezer - ayberkgezer@outlook.com

Repository

https://github.com/ayberkgezer/go-zed-snippets