I am asking this simple question as, after researching for quite some time, I still haven't found an answer yet.
I am trying to use this repository https://github.com/StefanAbl/go-freeipa, and updating the generated code with the latest freeipa version I use (which is 4.10 with API 2.280). In the "developping.md" instructions, they talk about a gen
tool to generate the freeipa code.
The code is using .json
files and a .gotmpl
file to generate the code (from what I could grasp).
I have NO idea what they are talking about. I have absolutely never coded in Go (but can fix things here and there due to the language ease of use) so I am not familiar with weel-known packages. I tried to find help online, especially with this tool https://github.com/clipperhouse/gen or the go generate
, but it doesn't seems right. The clipperhouse/gen
expects +gen
tags in the code (which doesnt exists in the repo) and go generate
does work with tags as well.
Note that I also tried to do a go run main.go
but I receive those errors:
# command-line-arguments
gen/main.go:53:21: undefined: Schema
gen/main.go:58:13: undefined: SchemaDump
gen/main.go:64:18: undefined: Command
gen/main.go:96:21: undefined: Class
gen/main.go:190:20: undefined: ErrDesc
gen/main.go:195:12: undefined: ErrDesc
gen/main.go:202:27: undefined: Schema
gen/main.go:202:42: undefined: ErrDesc
gen/main.go:204:16: undefined: toGoType
gen/main.go:215:11: undefined: Schema
gen/main.go:215:11: too many errors
After checking the code, indeed those (types?) are not declared which explains the errors. And I am not versed in the language enough to be able to fix this myself :( Or even if it needs fixing due to the fact that I should use this gen
tool instead.
If anyone has an idea on How I should generate the freeeipa/generated.go file, based on the files in freeipa/gen, that would be awesome :)
PS : For your curiosity on why I am doing this:
I am trying to update the go-freeipa package with the latest freeipa version
. The Freeipa-issuer https://github.com/guilhem/freeipa-issuer I am trying to setup on my K8S cluster is returning a
Failed to sign certificate request: Fail to request certificate: json: cannot unmarshal string into Go struct field CertRequestResult.result.value of type int
error> I hope this error comes from the fact that go-freeipa
client is using an oudated freeipa version
(4.9, api 2.170 instead of 4.10 and api 2.280) to generate the code.