muxt-goland-gotype

Enable GoLand type checking and code completion for Go HTML templates via gotype comments.

6|1|Updated Aug 5, 2024
One-click install
npx skills add https://github.com/typelate/muxt --skill muxt-goland-gotype
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: muxt-goland-gotype
Source: https://github.com/typelate/muxt/tree/main/docs/skills/goland-gotype
Command: npx skills add https://github.com/typelate/muxt --skill muxt-goland-gotype

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enhances the developer experience within JetBrains GoLand by enabling IDE features like code completion and type checking for Go HTML templates, specifically when using gotype comments.

Core Features & Use Cases

  • IDE Type Checking: Provides GoLand with type information for template contexts using gotype comments.
  • Code Completion: Enables autocompletion for fields within templates based on Go types.
  • Use Case: When developing a web application with Go HTML templates, use this Skill to ensure GoLand correctly identifies and suggests fields from your Go structs within template definitions, preventing typos and improving coding speed.

Quick Start

Add a gotype comment as the first line inside a template definition, specifying the fully qualified Go type path.

Frequently Asked Questions about muxt-goland-gotype

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get code completion for Go HTML templates in GoLand?

To get code completion for Go HTML templates in GoLand, you can use `gotype` comments to provide the IDE with type information for template contexts. This enables accurate field suggestions and type checking.

Why does GoLand not recognize struct fields in my Go HTML templates?

GoLand may not recognize struct fields if it lacks type context for the template. By adding a `gotype` comment with the fully qualified Go type path, the IDE can resolve types and enable proper autocompletion.

How do I add a gotype comment to a Go HTML template?

To add a gotype comment, place it as the first line inside your template definition and specify the fully qualified Go type path. This allows GoLand to identify and suggest fields from your Go structs.

Can I use GoLand static analysis for sub-templates called with different dot context types?

Yes, you can use this approach for sub-templates with different dot context types. The `gotype` comment mechanism provides IDE-level type resolution, ensuring accurate code completion and static analysis in these scenarios.

Does GoLand support type checking for Go HTML templates natively?

GoLand requires `gotype` comments to enable type checking for Go HTML templates. This feature satisfies the need for accurate code completion and static analysis within the GoLand environment for template development.