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

go install fails with too many errors #156

Open
veqryn opened this issue Sep 9, 2024 · 2 comments
Open

go install fails with too many errors #156

veqryn opened this issue Sep 9, 2024 · 2 comments

Comments

@veqryn
Copy link

veqryn commented Sep 9, 2024

Trying to use this project, but I can't even install it:
go install github.com/contiamo/openapi-generator-go/v2
Gives too many errors.

I am on Mac OS X with Golang 1.23

go install github.com/contiamo/openapi-generator-go/v2
# github.com/contiamo/openapi-generator-go/v2/pkg/generators/models
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/generate.go:94:23: invalid argument: g.spec.Paths (variable of type *openapi3.Paths) for built-in len
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/generate.go:98:30: cannot range over g.spec.Paths (variable of type *openapi3.Paths)
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/generate.go:236:21: invalid operation: s.Value.Type == "array" (mismatched types *openapi3.Types and untyped string)
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:26:26: cannot use "object" (untyped string constant) as *openapi3.Types value in assignment
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:33:44: invalid operation: propertyType != "array" (mismatched types *openapi3.Types and untyped string)
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:34:18: cannot use "ref" (untyped string constant) as *openapi3.Types value in assignment
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:38:7: cannot convert "object" (untyped string constant) to type *openapi3.Types
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:39:18: cannot use goTypeForObject(schemaRef) (value of type string) as *openapi3.Types value in assignment
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:41:7: cannot convert "string" (untyped string constant) to type *openapi3.Types
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:43:19: cannot use "time.Time" (untyped string constant) as *openapi3.Types value in assignment
../../../../pkg/mod/github.com/contiamo/openapi-generator-go/[email protected]/pkg/generators/models/go_type_from_ref.go:43:19: too many errors
@LucasRoesler
Copy link
Member

unfortunately, i can't reproduce this because I don't have a Mac. However, the cross-compile on Linux to Mac is working successfully for me.

Interestingly, it is also failing in CI during the release build

 # golang.org/x/exp/maps
Error: ../../../go/pkg/mod/golang.org/x/[email protected]/maps/maps.go:10:10: syntax error: unexpected [, expecting (
Error: ../../../go/pkg/mod/golang.org/x/[email protected]/maps/maps.go:20:12: syntax error: unexpected [, expecting (
Error: ../../../go/pkg/mod/golang.org/x/[email protected]/maps/maps.go:30:11: syntax error: unexpected [, expecting (
Error: ../../../go/pkg/mod/golang.org/x/[email protected]/maps/maps.go:44:15: syntax error: unexpected [, expecting (

I will need to investigate some more.

@LucasRoesler
Copy link
Member

I have reproduced your errors locally and they only happen when kin-openapi is incorrectly upgraded. Which is a very weird thing for go install to do on it's own, it should respect the pinned version in the mod file.

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