hashicorp / hashicorp/hcl

Label attributes in nested structs are ignored

Open
#348 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

### Go code
```go
type WithTwoAttributesAndLabel struct {
Name string `hcl:"name,label"`
A string `hcl:"a,optional"`
B string `hcl:"b,optional"`
}

type blockWithEmbeddedStruct struct {
WithTwoAttributesAndLabel `hcl:",remain"`
}

type withNestedEmbeddedBlock struct {
Nested *blockWithEmbeddedStruct `hcl:"nested,block"`
}
```

### HCL Template
```hcl
nested "name" {
a = "value"
b = "value"
}
```

### Expected behavior
The `nested` struct should have it's Name filled out with the value `name`

### Actual behavior
The name label is ignored but all other fields work fine

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.