hello,
I try to improbe my knowledge in go
for that I try to write a litle go program to change image use in my job file.
parsing job is OK but I don’t have all the nomad job structure so when I try to write modify job I only got information that I put in my struct.
to avoid to write a struct with all nomad block and attribute I have try to use nomad jobspec2 package like following
f,_ := os.Open(file)
job,_ := jobspec2.Parse(file,f)
fmt.Println(job.TaskGroups[0].Tasks[0].Config)
but when I run my code I got following compilation error
# github.com/hashicorp/nomad/jobspec2
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/hcl_conversions.go:20:23: undefined: gohcl.Decoder
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/hcl_conversions.go:28:29: undefined: gohcl.Decoder
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/hcl_conversions.go:29:20: undefined: gohcl.Decoder
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/parse_job.go:22:64: j.Periodic.Specs undefined (type *api.PeriodicConfig has no field or method Specs)
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/parse_job.go:60:26: t.Identities undefined (type *api.Task has no field or method Identities)
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/parse_job.go:62:8: t.Identity undefined (type *api.Task has no field or method Identity)
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/parse_job.go:71:36: t.Identities undefined (type *api.Task has no field or method Identities)
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/parse_job.go:85:7: v.DisableFile undefined (type *api.Vault has no field or method DisableFile)
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/parse_job.go:86:5: v.DisableFile undefined (type *api.Vault has no field or method DisableFile)
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/types.config.go:314:3: unknown field UndefinedVariable in struct literal of type hcl.EvalContext
../../../go/pkg/mod/github.com/hashicorp/nomad@v1.9.7/jobspec2/types.config.go:314:3: too many errors
does somebody know if we could use package jobspec2 in a standalone script?