Giter Site home page Giter Site logo

Comments (6)

StrongMonkey avatar StrongMonkey commented on May 30, 2024 2

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.

zhenghuiwang avatar zhenghuiwang commented on May 30, 2024 1

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.

munnerz avatar munnerz commented on May 30, 2024

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.

StrongMonkey avatar StrongMonkey commented on May 30, 2024

Yeah, end up with the same hack...

from gen-crd-api-reference-docs.

ahmetb avatar ahmetb commented on May 30, 2024

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.

delthas avatar delthas commented on May 30, 2024

Using the full import path also works on my end. This issue can be closed.

from gen-crd-api-reference-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.