Awesome GoLand

repository·main·Indexed 41 days ago

https://github.com/mukulmantosh/awesome-goland

A curated collection of hands-on demos, guides, and over 100 productivity tips for mastering the GoLand IDE. It covers advanced debugging (Smart Step Into, Goroutine dumping), testing, profiling, cloud-native workflows with Docker and Kubernetes, AI-assisted development, and gRPC implementation.

Tokens
33.7K
Snippets
84
Records
219
Agent score
53%

What's inside Awesome GoLand

  1. Overview of Awesome GoLand Modules

    main

    This repository is organized into several functional modules, each demonstrating specific GoLand capabilities. To learn how to use a specific feature, navigate to the corresponding directory and look for a DEMO.md or README.md file.

    Core Development

    • Debugging: Includes Smart Step Into, Goroutine Labeling, and Core Dumps.
    • Testing: Automated test generation and execution.
    • JSON to Struct: Converting JSON data to Go structs.
    • Resource Leak Detection: Identifying leaks early.
    • Structural Search & Replace: Pattern-based refactoring.

    API & Microservices

    • gRPC CRUD: Implementation of gRPC services.
    • Endpoint Discovery: Using the Endpoints tool window for REST APIs.

    Docker & Kubernetes

    • Docker Run Targets: Running and debugging Go apps in containers.
    • Kubernetes Integration: Orchestrating services with Kubernetes.

    Profiling & Performance

    • Profilers: Analyzing CPU, Memory, and Block profiles.

    AI & Extensibility

    • Junie: AI-assisted development workflows.
    • MCP (Model Context Protocol): Enhancing LLM interactions in the IDE.
  2. Explore GoLand productivity tips

    main

    The repository contains over 100 curated tips to boost productivity in GoLand, covering various categories such as:

    • Refactoring: e.g., Add Field to Struct, Extract Type Refactoring, Rename Symbol.
    • Code Completion: e.g., Smart Code Completion, Postfix Completion, Completion for Non Imported Go Modules.
    • Testing: e.g., Auto Run Tests, Generate a Test for Generic Function, Rerun Testify Subtest.
    • Docker & Kubernetes: e.g., Containers Restart a Running Container, Download Kubernetes Pod Log, Open Shell in Kubernetes.
    • Debugging & Profiling: e.g., Dump Goroutines, Evaluate Expression, Goroutines Profiler Labels.
    • Web Development: e.g., Tailwind CSS Support, Vue Support, Web React Refactor Names in UseState Hooks.
    • VCS (Version Control): e.g., VCS Run Tests Before Commit, VCS Sign Commit With GPG.

    Each tip is documented in its own file within the tips/ directory.

  3. Understand the Go retract directive in go.mod

    main

    The retract directive in a go.mod file is used to signal that a specific version or a range of versions of a module should not be used as dependencies. This is typically used when a version is published prematurely or contains severe bugs.

    In GoLand, the IDE automatically recognizes this directive, providing visual feedback or warnings when a project depends on a retracted version.

  4. Use Goroutine Profiler Labels to improve debugging

    main
    When working with complex Go programs that employ numerous goroutines, debugging can become difficult. Starting from Go 1.9, you can use Profiler Labels to capture extra information about the execution flow. By recording custom labels as part of your profiling data, you can attach context to goroutines, which allows you to analyze profiler outputs more effectively to understand exactly what different goroutines are doing.
  5. Understand the difference between Junie's Ask and Code modes

    main

    When using Junie, you can switch between two primary modes depending on your goal:

    • Code mode: Use this when you want Junie to execute specific tasks by writing and testing code on your behalf.
    • Ask mode: Use this for high-level interaction, such as asking questions, collaborating on architectural plans, or brainstorming ideas for new features and enhancements.
  6. Compare Junie's Ask mode with AI Assistant (AIA) Codebase mode

    main

    Junie's Ask mode and JetBrains AI Assistant (AIA) differ in how they collect context and interact with the LLM:

    • AI Assistant (AIA): Optimized for speed. It typically sends a single request to the LLM containing the necessary context.
    • Junie (Ask mode): Optimized for precision. It uses an iterative approach, making multiple LLM calls to work through a task. While this may take more time to generate a response, it can produce more precise and detailed results compared to the single-request method of AIA.
  7. Use Parameter Info to view function arguments

    main

    When working with functions that have many arguments or structs with many fields, you can use the Parameter Info feature to see a compact popup containing positional arguments, keyword arguments, and default values. This helps you understand the required parameters without cluttering your workspace.

    To use this feature:

    1. Place your cursor inside the parentheses of a function call.
    2. Invoke the command using the keyboard shortcut.
    3. The popup will display the parameter list, using bold text to indicate your current position in the list.

    You can invoke this at any time: before typing parameters, while typing, or when returning to modify existing parameters.

  8. Convert JSON to Go Types in GoLand

    main

    You can automatically generate Go struct definitions from JSON data using GoLand's built-in intelligence.

    1. Copy your JSON data to your clipboard.
    2. Paste the JSON into an empty location within your Go source file.
    3. When the IDE prompts you with a suggestion to convert the JSON to a Go type, select Yes.
    4. Provide a name for the new struct type to complete the action.
  9. Navigate to File in GoLand

    main

    The Navigate to File feature allows you to quickly search for and open files by name, even if you only know a partial name.

    You can scope your search to:

    • The current project only
    • Source code only
    • All places (including Go Modules dependencies and GOROOT)

    Pro tip: You can also use this feature to find a directory by its name.

    macOS: ⌘⇧O
    Windows/Linux: Ctrl+Shift+N
  10. Change struct tag style in GoLand

    main

    You can quickly change the casing of struct tag keys (e.g., switching from snake_case to camelCase) for an entire struct using GoLand's Context Actions.

    Supported styles include:

    • snake_case
    • camelCase
    • CamelCase
    • kebab-case

    Steps to apply:

    1. Place your cursor on a struct field.
    2. Invoke the Context Actions menu using <kbd>⌃⏎</kbd> (macOS) or <kbd>Ctrl+Enter</kbd> (Windows/Linux).
    3. Select Change field name style in tags.
    4. Choose your desired casing style from the available options.