golds
golds copied to clipboard
Golds v0.4.2 does not find go files
I ran the same command golds -gen -wdpkgs-listing=solo -only-list-exporteds -dir=../docs -nouses ./...
with Golds 0.4.1 and 0.4.2.
It works perfectly with Golds 0.4.1. However, with the latest version I get the following error:
-: no Go files in <...>
code-parse.go:301: exit for above errors.
If you are sure that the code should compile okay, and
you just upgraded your Go toolchain to a new Go version,
then please rebuild Golds with the following command.
go install go101.org/golds@latest
@acabarbaye Thanks for the report, I will check it soon.
Meanwhile, it will be very helpful if your project is open sourced.
I just created a new tag v0.4.3 for an earlier commit. Could you help me check if it works?
@acabarbaye Could you help me check if the error still exist in the latest develop branch?
@acabarbaye I will make a new tag v0.4.4 for this project. If it has the same problem as v0.4.2, please let me know.
The problem might be caused by a latest version of dependency package.
@acabarbaye
I create a main
branch which is updated to v0.4.2.
I will keep this branch unchanged for a long time.
If you still have problem using the latest Golds versions,
you can try to install Golds by run
go install go101.org/golds@main
though this branch doesn't support custom generics now.
Hi @go101, Thanks for looking into this I checked with golds 0.4.5 and I am getting the same problem. go101.org/golds@main does not work with go 1.18
λ golds -gen -wdpkgs-listing=solo -only-list-exporteds -dir=./tmps -nouses ./...
code-analyse.go:1087: !!! t.index: 238 interface{comparable}
panic: unnamed interface should have collected direct selectors now. &code.TypeInfo{TT:(*types.Interface)(0xc0000d8300), Underlying:(*code.TypeInfo)(0xc005700dc0), TypeName:(*code.TypeName)(nil), Implements:[]code.Implementation(nil), ImplementedBys:[]*code.TypeInfo(nil), Aliases:[]*code.TypeName(nil), Underlieds:[]*code.TypeName(nil), DirectSelectors:[]*code.Selector(nil), EmbeddingFields:0, AllMethods:[]*code.Selector(nil), AllFields:[]*code.Selector(nil), AsTypesOf:[]code.ValueResource(nil), AsInputsOf:[]code.ValueResource(nil), AsOutputsOf:[]code.ValueResource(nil), attributes:0x20000000, index:0xee, counter:0x69}
goroutine 1 [running]:
go101.org/golds/code.(*CodeAnalyzer).collectSelectorsForInterfaceType(0xf50600?, 0xc005700dc0, 0x1, 0x69, 0xc005c17850)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/code/code-analyse.go:1088 +0x9c7
go101.org/golds/code.(*CodeAnalyzer).collectSelectorsForInterfaceType(0xc005c17780?, 0xc00577f400, 0x0, 0x69, 0xc005c17850)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/code/code-analyse.go:1162 +0x6e8
go101.org/golds/code.(*CodeAnalyzer).analyzePackages_CollectSelectors(0xc004236000)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/code/code-analyse.go:904 +0xfe
go101.org/golds/code.(*CodeAnalyzer).AnalyzePackages(0xc004236000, 0xc005c17a20)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/code/code-analyse.go:61 +0x225
go101.org/golds/internal/server.(*docServer).analyze(0xc0000a6140, {0xc0000d6060, 0x1, 0xc58508?}, {{0xb70c60, 0x6}, {0x0, 0x0}, 0x0, 0x1, ...}, ...)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/internal/server/server.go:316 +0x4ce
go101.org/golds/internal/server.GenDocs({{0xb70c60, 0x6}, {0x0, 0x0}, 0x0, 0x1, 0x1, 0x0, 0x0, {0xb6ee51, ...}, ...}, ...)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/internal/server/tool_gen-docs.go:506 +0x377
go101.org/golds/internal/app.run()
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/internal/app/run.go:229 +0xf05
go101.org/golds/internal/app.Main(...)
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/internal/app/run.go:33
main.main()
C:/Users/adrcab01/go/pkg/mod/go101.org/[email protected]/main.go:10 +0x53
@acabarbaye I'm I forgot check this branch on 1.18. I just pushed a new commit and verified that it works for 1.18 now.
Sorry for my carelessness.
@acabarbaye Are there really some go files in the directory shown in the error message?
yes there is a whole go project see
λ ls -l
total 172
drw-rw-rw- 4 adrcab01 0 4096 2022-03-04 09:55 auth
drw-rw-rw- 2 adrcab01 0 4096 2022-03-04 09:55 cache
drw-rw-rw- 2 adrcab01 0 4096 2022-03-07 19:11 config
drw-rw-rw- 2 adrcab01 0 0 2022-02-16 10:52 context
drw-rw-rw- 3 adrcab01 0 4096 2022-03-02 11:03 entity
drw-rw-rw- 3 adrcab01 0 4096 2022-03-04 09:55 errors
-rw-rw-rw- 1 adrcab01 0 3806 2022-03-21 18:49 go.mod
-rw-rw-rw- 1 adrcab01 0 119586 2022-03-21 18:49 go.sum
drw-rw-rw- 2 adrcab01 0 0 2022-02-22 00:21 headers
drw-rw-rw- 4 adrcab01 0 4096 2022-03-21 17:04 links
drw-rw-rw- 2 adrcab01 0 0 2022-03-04 09:55 logger
drw-rw-rw- 3 adrcab01 0 4096 2022-03-04 09:55 marshalling
drw-rw-rw- 3 adrcab01 0 4096 2022-03-02 11:03 metadata
drw-rw-rw- 3 adrcab01 0 4096 2022-03-04 09:55 middleware
drw-rw-rw- 2 adrcab01 0 0 2022-02-22 00:35 mime
drw-rw-rw- 2 adrcab01 0 4096 2022-02-24 01:59 mocks
-rw-rw-rw- 1 adrcab01 0 110 2022-03-21 18:49 module.properties
drw-rw-rw- 3 adrcab01 0 4096 2022-03-21 18:49 pagination
drw-rw-rw- 2 adrcab01 0 0 2022-03-07 19:11 server
I can confirm that go101.org/golds@main works
it actually works on Windows but fails on Linux (the same command)
server.go:296: no packages matched
What does go list -json ./...
output?
I also ever encountered this problem when running Golds under a directory for the first time.
And what is the output for go list -e -json -compiled=true -test=false -export=true -deps=true -find=false -- ./...
?
Only the part for the "no Go files in" package part is needed.
What does
go list -json ./...
output?I also ever encountered this problem when running Golds under a directory for the first time.
See output on linux and windows output-simple-linux.txt output-simple-windows.txt
go list -e -json -compiled=true -test=false -export=true -deps=true -find=false -- ./...
See output on linux and windows: output-linux.txt
This project depends on golang.org/x/tools/go/packages
.
After spending some time to study the source code of the dependency package,
it looks to me the error no Go files in ...
should be contained
in the json output of the command
go list -e -json -compiled=true -test=false -export=true -deps=true -find=false -- ./...
But I didn't find the text in either output-linux.txt or output-windows.txt.
Maybe I haven't understanded the dependency code well.
It is great if you could upload a minimum project to reproduce this issue, by removing your private code.
BTW, I just pushed some small commits to the develop
branch.
These fixes might affect the no packages matched
problem a bit,
but I think they should be irrelevant to this no Go files in ...
problem, but I'm not100% sure.
@acabarbaye I just fixed another bug: https://github.com/go101/golds/issues/28, and I'm not sure whether or not the two bugs have the same cause.