Skip to content

Commit f031621

Browse files
docs: add FAQ regarding GOROOT env var (#3122)
Co-authored-by: Camila Macedo <[email protected]>
1 parent cb45a3b commit f031621

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

website/content/en/docs/faq.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,30 @@ func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Res
123123
}
124124
```
125125
126+
## I see deepcopy errors and image build fails. How do I fix this?
127+
128+
When you run the ```operator-sdk generate k8s``` command, you might see an error like this
129+
130+
```
131+
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [cache:[v1alpha1], ]
132+
F0523 01:18:27.122034 5157 deepcopy.go:885] Hit an unsupported type invalid type for invalid type, from github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1.Memcached
133+
```
134+
135+
This is because of the `GOROOT` environment variable not being set. More details [here][goroot-github-issue].
136+
137+
In order to fix this, you simply need to export the `GOROOT` environment variable
138+
139+
```
140+
$ export GOROOT=$(go env GOROOT)
141+
```
142+
143+
This will work for the current environment. To persist this fix, add the above line to your environment's config file, ex. `bashrc` file.
144+
126145
[kube-apiserver_options]: https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/#options
127146
[controller-runtime_faq]: https://github.com/kubernetes-sigs/controller-runtime/blob/master/FAQ.md#q-how-do-i-have-different-logic-in-my-reconciler-for-different-types-of-events-eg-create-update-delete
128147
[finalizer]: /docs/golang/quickstart/#handle-cleanup-on-deletion
129148
[gc-metrics]:/docs/golang/monitoring/prometheus/#garbage-collection
130149
[cr-faq]:https://github.com/kubernetes-sigs/controller-runtime/blob/master/FAQ.md
131150
[client.Reader]:https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#Reader
132151
[rbac]:https://kubernetes.io/docs/reference/access-authn-authz/rbac/
152+
[goroot-github-issue]:https://github.com/operator-framework/operator-sdk/issues/1854#issuecomment-525132306

0 commit comments

Comments
 (0)