Comments (6)
FYI, I fixed this issue by specifying the full package name in the command line.
For example,:
$ refdocs -config ./docs/doc-config.json -api-dir "github.com/rancher/gitjob/pkg/apis/gitjob.cattle.io/v1" -out-file ./api-docs.md --template-dir ./docs
I think this is how k8s.io gengo and go package works, you have to put into a path that is being imported somewhere.
from gen-crd-api-reference-docs.
I tried to generate docs for Kubeflow Notebook Controller, but failed because it uses go module with replace statement. Tried the above work around, but it doesn't work in this case:
go.mod is
https://github.com/kubeflow/kubeflow/blob/master/components/notebook-controller/go.mod
gen-crd-api-reference-docs master !1 ?1 ❯ ./gen-crd-api-reference-docs -config="example-config.json" -api-dir="github.com/kubeflow/kubeflow/components/notebook-controller/api/v1beta1" -out-file=doc.html
I0113 16:14:07.681060 13420 main.go:127] parsing go packages in directory github.com/kubeflow/kubeflow/components/notebook-controller/api/v1beta1
W0113 16:14:08.137690 13420 parse.go:224] Ignoring directory github.com/kubeflow/kubeflow/components/notebook-controller/api/v1beta1: unable to import "github.com/kubeflow/kubeflow/components/notebook-controller/api/v1beta1": go/build: importGo github.com/kubeflow/kubeflow/components/notebook-controller/api/v1beta1: exit status 1
go: finding github.com/kubeflow/kubeflow/components/notebook-controller latest
go: github.com/kubeflow/kubeflow/components/[email protected] requires
github.com/kubeflow/kubeflow/components/[email protected]: reading https://proxy.golang.org/github.com/kubeflow/kubeflow/components/common/@v/v0.0.0-00010101000000-000000000000.mod: 410 Gone
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1422a65]
goroutine 1 [running]:
k8s.io/gengo/parser.(*Builder).AddDirRecursive(0xc0001cc000, 0x7ffeefbff802, 0x47, 0x94, 0xe8)
/Users/zhenghui/go/pkg/mod/k8s.io/[email protected]/parser/parse.go:229 +0xb5
main.parseAPIPackages(0x7ffeefbff802, 0x47, 0x15427cf, 0x23, 0xc000171f10, 0x1, 0x1)
/Users/zhenghui/github.com/ahmetb/gen-crd-api-reference-docs/main.go:201 +0x60
main.main()
/Users/zhenghui/github.com/ahmetb/gen-crd-api-reference-docs/main.go:128 +0x2ca
from gen-crd-api-reference-docs.
To work around this, we construct a 'fake gopath' using go mod vendor
in cert-manager: https://github.com/cert-manager/website/blob/172648ac48c09c2004b5ba3049346c84b5462722/scripts/gendocs/generate
It'd be great to skip this step 😄
from gen-crd-api-reference-docs.
Yeah, end up with the same hack...
from gen-crd-api-reference-docs.
Sorry for the silence here, turns out I wasn't watching the repo. /facepalm
Yes, your $PWD has to be within the go module, and you should use the Go module path as the package name (I think). Nothing we can fix here. That's how gengo
works.
from gen-crd-api-reference-docs.
Using the full import path also works on my end. This issue can be closed.
from gen-crd-api-reference-docs.
Related Issues (20)
- anchorid should not contains with slash
- [wip] Add support for kubebuilder v2 HOT 10
- Emit documentation for typed constants HOT 2
- Type aliases get collapsed down into the underlying type. HOT 1
- Add a --version flag to the binary
- Add flag to sort APIGroups in output HOT 1
- automatically link type names found in the doc comments HOT 2
- HTML packages produces urlencoded %2f HOT 3
- HTML output produced may be not valid HOT 1
- The typeDisplayName (rendered name of Type) is not correct when it is of type Slice of Pointers HOT 2
- Is it possible to run directly against OpenAPI v3 schema? HOT 1
- include a default template with go fs embed
- Option to generate AsciiDoc output
- linkForType and typeDisplayName wrong when a field is a slice of pointers HOT 1
- leading spaces removed from ``` sections HOT 2
- Relase for latest version
- Got "Invalid memory address or nil pointer dereference" HOT 1
- [go1.20] tool doesn't recurse into sub-directories HOT 2
- Incorrect display of map types
- could not get apiVersion for package k8s.io/apiextensions-apiserver/... HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gen-crd-api-reference-docs.