|  | 
| 53 | 53 | 	readme string | 
| 54 | 54 | ) | 
| 55 | 55 | 
 | 
| 56 |  | -const HCLLABELINDEXKEY = "hcllabelindex" | 
|  | 56 | +const HCL_LABEL_INDEX_KEY = "hcllabelindex" | 
| 57 | 57 | 
 | 
| 58 | 58 | type Command struct { | 
| 59 | 59 | 	typeNames string | 
| @@ -294,7 +294,7 @@ func goFieldToCtyType(accessor string, fieldType types.Type, tags *structtag.Tag | 
| 294 | 294 | 	case *types.Basic: | 
| 295 | 295 | 		if f.Kind() == types.String { | 
| 296 | 296 | 			hcl, err1 := tags.Get("hcl") | 
| 297 |  | -			hcllabelindex, err2 := tags.Get(HCLLABELINDEXKEY) | 
|  | 297 | +			hcllabelindex, err2 := tags.Get(HCL_LABEL_INDEX_KEY) | 
| 298 | 298 | 			if err1 == nil && err2 == nil && hcl.HasOption("label") { | 
| 299 | 299 | 				index, err := strconv.Atoi(hcllabelindex.Name) | 
| 300 | 300 | 				if err != nil { | 
| @@ -397,7 +397,7 @@ func outputStructFields(w io.Writer, s *types.Struct) { | 
| 397 | 397 | 		if err == nil { | 
| 398 | 398 | 			// Remove hcllabelindex from the printout because it is not needed | 
| 399 | 399 | 			// in the generated struct. | 
| 400 |  | -			st.Delete(HCLLABELINDEXKEY) | 
|  | 400 | +			st.Delete(HCL_LABEL_INDEX_KEY) | 
| 401 | 401 | 		} | 
| 402 | 402 | 		fieldNameStr := field.String() | 
| 403 | 403 | 		fieldNameStr = strings.Replace(fieldNameStr, "field ", "", 1) | 
| @@ -491,7 +491,7 @@ func addTagsToStruct(s *types.Struct) (*types.Struct, error) { | 
| 491 | 491 | 					return nil, fmt.Errorf("field %q has an hcl label struct tag but is not a string or string pointer", ctyAccessor) | 
| 492 | 492 | 				} | 
| 493 | 493 | 				hclOptions = append(hclOptions, "label") | 
| 494 |  | -				st.Set(&structtag.Tag{Key: HCLLABELINDEXKEY, Name: fmt.Sprintf("%d", hclLabelIndex)}) | 
|  | 494 | +				st.Set(&structtag.Tag{Key: HCL_LABEL_INDEX_KEY, Name: fmt.Sprintf("%d", hclLabelIndex)}) | 
| 495 | 495 | 				hclLabelIndex++ | 
| 496 | 496 | 				if required, err := st.Get("required"); err == nil { | 
| 497 | 497 | 					required.Name = "true" // All labels are always required | 
|  | 
0 commit comments