<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dinesh Chavan</title>
    <description>The latest articles on DEV Community by Dinesh Chavan (@chavandinesh).</description>
    <link>https://dev.to/chavandinesh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F914752%2F6c9fdb6b-d055-43c1-a89f-2fed72f78b11.jpeg</url>
      <title>DEV Community: Dinesh Chavan</title>
      <link>https://dev.to/chavandinesh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chavandinesh"/>
    <language>en</language>
    <item>
      <title>Escaping jinja2</title>
      <dc:creator>Dinesh Chavan</dc:creator>
      <pubDate>Mon, 20 Mar 2023 14:15:23 +0000</pubDate>
      <link>https://dev.to/chavandinesh/escaping-jinja2-k2</link>
      <guid>https://dev.to/chavandinesh/escaping-jinja2-k2</guid>
      <description>&lt;p&gt;Hello Experts,&lt;br&gt;
I want to escape '\' in jinja template am using in terraform, I tried multiple ways but somehow it's not happening!&lt;br&gt;
Below is the code snippet :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{%- if mrecords['type'] == "TXT" %}
                        {%- if mrecords['values'] is defined -%}
                            {%- set txtrecord_set = namespace(value=[]) -%}
                            {%- for txtrecord in mrecords['values'] -%}
{%- set txt_value = '"' ~ '\' ~ '"' ~ txtrecord ~ '\' ~ '"' ~ '"'  -%}                              
                                {%- set txtrecord_set.value = txtrecord_set.value | append(txt_value) -%}
                            {%- endfor -%}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Unable to parse statement "if": Unable to parse statement "for": Unable to parse statement "set": Malformed 'set'-tag args. (Line: 63 Col: 66, near "' ~ txtrecord ~ '' ~ '")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>help</category>
      <category>jinja2</category>
    </item>
    <item>
      <title>Golang array</title>
      <dc:creator>Dinesh Chavan</dc:creator>
      <pubDate>Wed, 24 Aug 2022 16:00:19 +0000</pubDate>
      <link>https://dev.to/chavandinesh/golang-array-1amo</link>
      <guid>https://dev.to/chavandinesh/golang-array-1amo</guid>
      <description>&lt;p&gt;Hi Experts,&lt;br&gt;
Am new to Golang and stuck with calling array element in Golang, on internet i don't find any example of array element with user inputs.&lt;br&gt;
Here is the snippet of function which is getting failed during compile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;func resourceRoleManagementCreate(d *schema.ResourceData, meta interface{}) error {
    config := meta.(Config)
  resourceAction := "create"
  rc := &amp;amp;RoleCreate{
    Action: resourceAction,
    Resources: RoleCreateConfig{
      Name: d.Get("name").(string),
            Settings: SettingsConfig{
        Restrictions: Restrictions{
                    Vms: d.Get("vms").(string),
                },
      },
            Features: FeaturesConfig{
        Identifier: d.Get("identifier").(string),
      },
    },
  }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Schema definition is as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// RoleConfig for Role Management
type RoleCreate struct {
    Action   string        `json:"action"`
    Resources  RoleCreateConfig   `json:"resources"`
}

type FeaturesConfig struct {
    Identifier string `json:"identifier"`
}

type RoleCreateConfig struct {
    Name     string     `json:"name"`
    Settings SettingsConfig   `json:"settings"`
    Features []FeaturesConfig `json:"features"`
}

type SettingsConfig struct {
    Restrictions Restrictions `json:"restrictions"`
}

type Restrictions struct {
    Vms string `json:"vms"`
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Error am getting while compiling is as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;infra8/resource_role_management.go:58:14: cannot use FeaturesConfig{…} (value of type FeaturesConfig) as type []FeaturesConfig in struct literal
make: *** [build] Error 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
