Probably a question that’s a bit out of the ordinary.
I have the use case where I have to parse nomad job files from a go program. There are some 3rd party libs that do this, however, I’m trying to use nomad’s own implementation to do so via:
https://pkg.go.dev/github.com/hashicorp/nomad/jobspec2
However, when trying to get the modules with go get github.com/hashicorp/nomad/jobspec2
I get the following errors:
# github.com/hashicorp/nomad/jobspec2
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:293:16: tg.Scaling.Type undefined (type *api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:294:14: tg.Scaling.Type undefined (type *api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:443:7: p.Type undefined (type api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:444:5: p.Type undefined (type api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:445:14: p.Type undefined (type api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:451:7: p.Type undefined (type api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:457:37: task.ScalingPolicies undefined (type *api.Task has no field or method ScalingPolicies)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:465:11: invalid operation: p.Max != nil (mismatched types int64 and nil)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:465:22: p.Type undefined (type *api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:485:6: p.Type undefined (type *api.ScalingPolicy has no field or method Type)
../../../../go/pkg/mod/github.com/hashicorp/nomad@v1.2.4/jobspec2/hcl_conversions.go:485:6: too many errors
I looked at the files and it seems that these are not actually defined. I’m still a bit of a go noob so I’m not sure what I’m doing wrong.