-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cty.Value does not implement gob.GobEncoder #187
Comments
…/go-cty In an effort to provide Packer plugins access to the github.com/zclconf/go-cty enhancements, while still providing access to encoding/gob support the Packer team has forked the go-cty package under github.com/nywilken/go-cty. This is a temporary fork that will be removed once it is no longer needed. Refer to #187
…/go-cty In an effort to provide Packer plugins access to the github.com/zclconf/go-cty enhancements, while still providing access to encoding/gob support the Packer team has forked the go-cty package under github.com/nywilken/go-cty. This is a temporary fork that will be removed once it is no longer needed. Refer to #187
After following option - 1 I'm getting error while running
is this also an issue, anybody faced it, how to resolve it |
FYI : |
@Prateeknandle thanks again for bubbling this up. As you found version of hcl/v2 2.17.0+ required a newer version of the github.com/zclconf/go-cty. This issue has been addressed in the latest Packer Plugin SDK release v0.5.2, where the go-cty fork now contains all the changes from zclconf/[email protected]. To update your plugin pull down the latest version of the Packer plugin SDK and re-apply the GoCty fix. go get github.com/hashicorp/[email protected]
go install github.com/hashicorp/packer-plugin-sdk/cmd/[email protected]
packer-sdc fix .
go mod tidy |
Manual intervention required to update: * github.com/hashicorp/hcl/v2 * github.com/hashicorp/packer-plugin-sdk * github.com/zclconf/go-cty See hashicorp/packer-plugin-sdk#187 for further context.
* Bump github.com/hashicorp/packer-plugin-sdk from 0.5.1 to 0.5.2 Bumps [github.com/hashicorp/packer-plugin-sdk](https://github.com/hashicorp/packer-plugin-sdk) from 0.5.1 to 0.5.2. - [Release notes](https://github.com/hashicorp/packer-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/packer-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](hashicorp/packer-plugin-sdk@v0.5.1...v0.5.2) --- updated-dependencies: - dependency-name: github.com/hashicorp/packer-plugin-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Apply `packer-sdc fix .` See also hashicorp/packer-plugin-sdk#187 (comment) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daniel Bast <[email protected]>
Related Errors
What's this Error?
In v1.11.0, the github.com/zclconf/go-cty package dropped support for
encoding/gob
. Gob support is used by the Packer SDK to serialize HCL2 object specs over the wire. If a plugin or Packer upgrades their version of github.com/zclconf/go-cty to one that does not contain Gob support (v1.11.0+) the plugin will build but crash when trying to run a build on an HCL2 template.The error being reported above is due to a compile type check added to the Packer SDK to alert a consumer of the SDK that they are using an unsupported version of github.com/zclconf/go-cty. The
gob.GobEncodercheck
was added as a guard to prevent Packer SDK consumers from becoming out of sync with unsupported go-cty versions.How to fix this Error #
If you are seeing this error then you are running a release of the Packer plugin SDK that now enforces a type check for the
encoding/gob
support in github.com/zclconf/go-cty. There are a number of ways to fix this issue, which are all meant to be temporary fixes until v1.0.0 of the Packer Plugin SDK, which will move from usingencoding/gob
for serializing cty Values.In an effort to provide Packer plugins access to the github.com/zclconf/go-cty enhancements, while still providing access to
encoding/gob
support the Packer team has forked the go-cty package under github.com/nywilken/go-cty. This is a temporary fork that will be removed once it is no longer needed. Until then plugin developers are encourage to use the fork as a replacement (within the go.mod file) for github.com/zclconf/go-cty.For a complete list of changes within the go-cty fork for Packer refer to the CHANGELOG
If you are using a version of the Packer Plugin SDK prior to the release of the compile time check within the SDK you can simply use the recommended replace directive (Option 1) to pull in the fork and gain access to the latest enhancements to go-cty.
Option 1: Run
packer-sdc fix
CommandIn an effort to automate the temporary fix, and its removal in the future, a fix sub-command has been added to the
packer-sdc
command; not to be confused withpacker fix
which fixes legacy JSON template files.By running the
packer-sdc fix
command within the plugin's root project directory the command will check the plugin's go.mod file has a replace directive to the go-cty fork.If no replace directive is found it will be automatically added to the go.mod file, which you can then run
go mod tidy
andgo test ./... -v
against your plugin to verify the fix has been applied.In the future release running
packer-sdc fix
will update versions of the fork, and when the time comes remove it from the mod file.Option 2: Manual Replace Directive
Add a replace directive to the go.mod file within your plugin's project root directory.
Please check the fork CHANGELOG and tags for the latest tagged release.
The text was updated successfully, but these errors were encountered: