Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golds v0.4.2 does not find go files #26

Open
acabarbaye opened this issue Feb 17, 2022 · 19 comments
Open

Golds v0.4.2 does not find go files #26

acabarbaye opened this issue Feb 17, 2022 · 19 comments

Comments

@acabarbaye
Copy link

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
@zigo101
Copy link
Collaborator

zigo101 commented Feb 18, 2022

@acabarbaye
Thanks for the report, I will check it soon.

@zigo101
Copy link
Collaborator

zigo101 commented Feb 18, 2022

Meanwhile, it will be very helpful if your project is open sourced.

@zigo101
Copy link
Collaborator

zigo101 commented Feb 18, 2022

I just created a new tag v0.4.3 for an earlier commit.
Could you help me check if it works?

@zigo101
Copy link
Collaborator

zigo101 commented Mar 6, 2022

@acabarbaye
Could you help me check if the error still exist in the latest develop branch?

@zigo101
Copy link
Collaborator

zigo101 commented Mar 12, 2022

@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.

@zigo101
Copy link
Collaborator

zigo101 commented Mar 17, 2022

@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.

@acabarbaye
Copy link
Author

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

@zigo101
Copy link
Collaborator

zigo101 commented Mar 22, 2022

@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.

@zigo101
Copy link
Collaborator

zigo101 commented Mar 22, 2022

Sorry for my carelessness.

@zigo101
Copy link
Collaborator

zigo101 commented Mar 22, 2022

@acabarbaye
Are there really some go files in the directory shown in the error message?

@acabarbaye
Copy link
Author

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

@acabarbaye
Copy link
Author

I can confirm that go101.org/golds@main works

@acabarbaye
Copy link
Author

it actually works on Windows but fails on Linux (the same command)

server.go:296: no packages matched

@zigo101
Copy link
Collaborator

zigo101 commented Mar 22, 2022

What does go list -json ./... output?

I also ever encountered this problem when running Golds under a directory for the first time.

@zigo101
Copy link
Collaborator

zigo101 commented Mar 22, 2022

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.

@acabarbaye
Copy link
Author

acabarbaye commented Mar 22, 2022

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

@acabarbaye
Copy link
Author

go list -e -json -compiled=true -test=false -export=true -deps=true -find=false -- ./...

See output on linux and windows:
output-linux.txt

output-windows.txt

@zigo101
Copy link
Collaborator

zigo101 commented Mar 23, 2022

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.

@zigo101
Copy link
Collaborator

zigo101 commented Apr 25, 2022

@acabarbaye
I just fixed another bug: #28, and I'm not sure whether or not the two bugs have the same cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants