Developers working with Go templates and the html/template package may encounter the following errors in Visual Studio Code (VSCode):
These errors often arise when attempting to inject dynamic values into style attributes using double curly braces {{ }} in .tmpl files.
The issue stems from the HTML validation feature in VSCode. While it helps ensure the validity of HTML syntax, it can also conflict with the use of Go templates. To resolve the problem:
After disabling style validation, double curly braces {{ }} can be used in style attributes without triggering errors.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3