Skip to content

Errors when building generated main.go #113

@amalic

Description

@amalic

Dislaimer: I come from JavaLand. Applolgies if I am reporting something that would be easy to solve for people living in GoLand.

I am trying out NAML to cofify an existing deployment

  1. I exported our deployment to yaml first via kubectl get all -n <my_namespace> -o yaml | tee out/all.yaml which resulted in a yaml file with 24031 lines
  2. Then I switched to the out folder and converted it to go via cat all.yaml | naml codify > main.go which resulted in a go file with 26986 lines
  3. Now that I tried go build main.go I am getting following errors
> naml build -o app
2022-04-25T11:14:16+02:00 [Warning   ]  ⚠ naml build alpha feature ⚠
2022-04-25T11:14:16+02:00 [Warning   ]  if this is a feature you plan on using please make your use case known in the issue tracker
2022-04-25T11:14:16+02:00 [Warning   ]  ⚠ naml build alpha feature ⚠
2022-04-25T11:14:17+02:00 [Critical  ]  unable to build NAML binary from source: 

+-------------------------+---------------------------------
| Codify Compile Failure  |
+-------------------------+
| 
| 
| # command-line-arguments
/tmp/3648555560.go:171:9: unknown field 'i' in struct literal of type resource.Quantity
/tmp/3648555560.go:171:21: int64Amount not exported by package resource
/tmp/3648555560.go:172:10: unknown field 'value' in struct literal of type resource.int64Amount
/tmp/3648555560.go:173:10: unknown field 'scale' in struct literal of type resource.int64Amount
/tmp/3648555560.go:175:9: unknown field 's' in struct literal of type resource.Quantity
/tmp/3648555560.go:179:9: unknown field 'i' in struct literal of type resource.Quantity
/tmp/3648555560.go:179:26: int64Amount not exported by package resource
/tmp/3648555560.go:179:38: unknown field 'value' in struct literal of type resource.int64Amount
/tmp/3648555560.go:180:9: unknown field 's' in struct literal of type resource.Quantity
/tmp/3648555560.go:186:21: int64Amount not exported by package resource
/tmp/3648555560.go:186:21: too many errors
+----------------------------------------------------------

Another thing that was quite strange to me was that NAML generated properties like NodeName: with the node a certain pod is currently running on. Haven't looked further but my gut feeling tells me that it generates code for pods resulting from staeful/daemon/replica-sets which doesn't feel right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions