Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Golang Basic SnippetsNew to Visual Studio Code? Get it now.
Golang Basic Snippets

Golang Basic Snippets

Snippington

|
849 installs
| (0) | Free
Basic snippets for development in Go (based on gobyexample.com).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Snippington Golang Basic

This VSCode extension provides a comprehensive collection of useful Golang snippets to accelerate your Go development workflow.

50+ Snippets for Golang Development

Most of the snippets are based on examples from gobyexample.com.

Features

  • Consistent prefix pattern (go:) for easy discovery
  • Covers essential Go patterns and constructs
  • Properly formatted with placeholders for customization
  • Organized by category (basics, functions, data structures, concurrency, HTTP)

Available Snippets

Prefix Description
go: hello Go Hello World app
go: pkg Set a Go package name
go: fn A simple function
go: func A simple function
go: func-public A simple public function
go: print Print to console
go: main Main Function
go: var Variable
go: short-var Short variable
go: const Constant
go: switch Switch
go: arr Array
go: slice Slice
go: map Map
go: range Range
go: func-mult Function with multiple values returned
go: func-variadic Variadic functions
go: pointer Pointer
go: struct Struct
go: struct-embedded Embedded struct
go: struct-method Method for a struct
go: error Raise error
go: routine-anon Anonymous goroutine
go: routine-basic Basic goroutine
go: channel Channel
go: channel-buffered Buffered channel
go: channel-wait-select Using select to wait on channels
go: channels-range Range over channels
go: worker-pools Worker pools
go: waitgroup WaitGroup declaration
go: waitgroup-snippet WaitGroup implementation snippet
go: mutex-snippet Mutex implementation snippet
go: server-hello HTTP Server Hello World
go: server-set-header HTTP Server Set Header
go: server-form-post-value HTTP Server Get Form Post Value
go: server-query-string HTTP Server Get Query String Value
go: server-return-json HTTP Server return JSON snippet
go: server-serve-image HTTP Server serve an image
go: server-serve-static HTTP Server serve static files
go: server-middleware HTTP Server Middleware
go: server-file-upload HTTP Server File Upload Handler
go: server-logging-middleware Server middleware for logging
go: server-chained-middleware-sample Chained Middleware sample app
go: unit-test Unit Test
go: cli-args Read Command Line Args
go: interface Define interface
go: file-write Write to file
go: write-to-log Write to log file
go: env-get Get environment variable
go: env-set Set environment variable

Installation

  1. Open VS Code
  2. Press Ctrl+P (or Cmd+P on macOS)
  3. Type ext install snp-go-basic
  4. Press Enter

Usage

In any Go file, start typing go: to see a list of available snippets and select the one you need.

Feedback and Contributions

If you find any issues or have suggestions for new snippets, please open an issue on the GitHub repository.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft