Skip to content

Instantly share code, notes, and snippets.

@rossja
Last active February 12, 2019 01:52
Show Gist options
  • Save rossja/82959e34ccdb20b0a08fc08edb5cb4d6 to your computer and use it in GitHub Desktop.
Save rossja/82959e34ccdb20b0a08fc08edb5cb4d6 to your computer and use it in GitHub Desktop.
Fixing Laforge cty.primitiveType errors

When running laforge, if you get the following error:

panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType

The following steps can be taken to fix it:

  1. Edit $GOPATH/src/github.com/hashicorp/terraform/vendor/github.com/zclconf/go-cty/cty/types_to_register.go
  2. Comment out the following import statements:
 "math/big"
 "github.com/zclconf/go-cty/cty/set"
  1. Change func init() to look like this:
 func init() {
   InternalTypesToRegister = []interface{}{
 //    primitiveType{},
 //    typeList{},
 //    typeMap{},
 //    typeObject{},
 //    typeSet{},
 //    setRules{},
 //    set.Set{},
 //    typeTuple{},
 //    big.Float{},
 //    capsuleType{},
     []interface{}(nil),
     map[string]interface{}(nil),
 45   }
  1. Rebuild laforge using go build github.com/gen0cide/laforge/cmd/laforge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment