Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Golang Enum GeneratorNew to Visual Studio Code? Get it now.
Golang Enum Generator

Golang Enum Generator

Jennsen

| (0) | Free
Generates Golang iota enums from filenames with multiple cases
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Golang Enum Generator

A professional VS Code extension to automate the generation of Golang enums using the iota pattern. It handles construction, string conversion, and provides lookup method.

Features

  • Generate Enum: Create a full enum structure from scratch. Automatically detects package and determines the type name from the filename.
  • Add Cases: Add new cases to an existing enum at any time. It merges existing cases with new ones.
  • Remove Cases: Easily remove one or more cases from an existing enum.

Commands

Command Description
Golang Enum Generator: Generate Generates a new enum or replaces an existing one with new cases.
Golang Enum Generator: Add Appends new cases to an existing enum.
Golang Enum Generator: Remove Removes specified cases from an existing enum.

Usage

  1. Open or create a .go file (e.g., user_role.go).
  2. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).
  3. Search for one of the Golang Enum Generator commands.
  4. Follow the prompts to enter case names (comma-separated).

Example Output

package vo

import "strings"

type DeviceStatus int

const (
	DeviceStatusUnknown DeviceStatus = iota
	DeviceStatusActivated
	DeviceStatusDeactivated

	DeviceStatusUnknownValue = "UNKNOWN"
	DeviceStatusActivatedValue = "ACTIVATED"
	DeviceStatusDeactivatedValue = "DEACTIVATED"
)

func NewDeviceStatusFromString(value string) DeviceStatus {
	v := strings.ToUpper(strings.TrimSpace(value))
	switch v {
	case DeviceStatusUnknownValue:
		return DeviceStatusUnknown
	case DeviceStatusActivatedValue:
		return DeviceStatusActivated
	case DeviceStatusDeactivatedValue:
		return DeviceStatusDeactivated
	default:
		return DeviceStatusUnknown
	}
}

func (e DeviceStatus) Value() string {
	return [...]string{
		DeviceStatusUnknownValue,
		DeviceStatusActivatedValue,
		DeviceStatusDeactivatedValue,
	}[e]
}

Requirements

  • VS Code version 1.80.0 or higher.
  • A Go environment for formatting (recommended).

License

This project is licensed under the MIT License - see the LICENSE file for details.

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