ahmetb / gen-crd-api-reference-docs

API Reference Docs generator for Kubernetes CRDs (used by Knative, Kubeflow and others)
Apache License 2.0
298 stars 98 forks source link

Got "Invalid memory address or nil pointer dereference" #60

Open emmayylu opened 1 year ago

emmayylu commented 1 year ago

I am pretty new to Golang. I've been trying the "Try it out" section in the README for more than one hour and still haven't figured out how to use it successfully.

I have tried different working directories and changed different things. I would describe the closest I can get even though I don't think what I am doing makes sense:

pwd shows I am inside folder_a/gen-crd-api-reference-docs. Folder structure currently looks like:

+-- folder_a
|     +-- my_project
|            +-- api
|                  +-- component.html
|                  +-- component.md
|            +--pkg
|                 +-- apis
|                        +-- component
|                               +-- v1alpha1
|                                      +-- types.go
|     +-- gen-crd-api-reference-docs
|            +-- gen-crd-api-reference-docs
|            +-- example-config.json

Command I run:

./gen-crd-api-reference-docs \
-config "./example-config.json" \
-api-dir "github.com/knative/build/pkg/apis/build/v1alpha1" \
-out-file docs.html

my GOPATH: "/Users/myname/go" Error: invalid memory address or nil pointer dereference

I am currently just learning how to use it, but my end goal is to make changes to component.md and component.html based on types.go

What did I do wrong? How can I fix it? Thanks for your help in advance!

ahmetb commented 1 year ago

I recommend looking at the projects using it (see README) and see how they do it. The tool has a lot of rough edges.