I am currently trying to upgrade one project, and vendor another both of which import "github.com/hashicorp/nomad/nomad/structs", however, I am unable to correctly build due to failures with codecgen.
I have removed all traces of codec/codecgen from my machine, and install via the Nomad provided script; which requires you to have the codec/codecgen module locally for anyone seeing the same issue.
When I attempt to test and build my project, I get the follow type of errors:
# github.com/hashicorp/nomad/nomad/structs
../../../../pkg/mod/github.com/hashicorp/[email protected]/nomad/structs/structs.generated.go:588:24: z.EncBasicHandle().StringToRaw undefined (type *"github.com/ugorji/go/codec".BasicHandle has no field or method StringToRaw)
../../../../pkg/mod/github.com/hashicorp/[email protected]/nomad/structs/structs.generated.go:589:28: z.BytesView undefined (type "github.com/ugorji/go/codec".genHelperEncoder has no field or method BytesView)
I have also tried removing the ~/go/pkg/mod/github.com/hashicorp/[email protected] directory, but this has not resolved the issue.
The only change I am making to the project is:
import (
+ "github.com/hashicorp/nomad/nomad/structs"
- case "pending":
+ case structs.AllocClientStatusPending:
I'd suggest depending on the public /api package AllocClientStatusPending[1] instead. The /api package is go-mod and doesn't pull any internal or unnecessary external packages.
Sadly, the rest of nomad project isn't go-mod friendly yet and we aim to address in the follow up release. Would that address your issue?
Taking 馃憤 as problem solved :). Closing for now then and will address overall go mod friendliness in a separate effort.
Most helpful comment
I'd suggest depending on the public
/apipackageAllocClientStatusPending[1] instead. The/apipackage is go-mod and doesn't pull any internal or unnecessary external packages.Sadly, the rest of nomad project isn't go-mod friendly yet and we aim to address in the follow up release. Would that address your issue?