chukmunnlee / caddy-openapi

A Caddy module to validate HTTP request and response against a OpenAPI spec (V3) file
Apache License 2.0
23 stars 7 forks source link

Cannot build with go1.22.3 #8

Closed bijancn closed 4 months ago

bijancn commented 5 months ago

I tried to build on MacOs/darwin with the latest go version = 1.22.3 but find this error

2024/05/27 13:41:57 [INFO] Building Caddy
2024/05/27 13:41:57 [INFO] exec (timeout=0s): /opt/homebrew/bin/go mod tidy -e
2024/05/27 13:41:58 [INFO] exec (timeout=0s): /opt/homebrew/bin/go build -o /Users/bijanchokoufenejad/repos/caddy-openapi/dist/caddy-amd6-darwin-cd81d8d -ldflags -w -s -trimpath -tags nobadger
# github.com/lucas-clemente/quic-go/internal/qtls
../../../go/pkg/mod/github.com/lucas-clemente/quic-go@v0.28.0/internal/qtls/go120.go:6:13: cannot use "The version of quic-go you're using can't be built on Go 1.20 yet. For more details, please see https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.20 yet. F...) as int value in variable declaration
2024/05/27 13:41:58 [INFO] Cleaning up temporary folder: /Users/bijanchokoufenejad/repos/caddy-openapi/buildenv_2024-05-27-1341.184093256
2024/05/27 13:41:58 [FATAL] exit status 1
make: *** [darwin] Error 1

What confuses me a bit is that the error message indicates that quic-go@v0.28.0 cannot work on Go later than 1.20 but you indicate that the build was tested on go version = 1.21.1 in the README?

Anyway, I guess it could solved by upgrading quic-go to the latest version.

bijancn commented 4 months ago

Somehow my browser posted twice. Duplicate of #7

chukmunnlee commented 4 months ago

Hi I am able to compile on my machine ;-). My config go version go1.22.3 linux/amd64 Ubuntu 22.04

I have updated all the dependencies.

bijancn commented 4 months ago

@chukmunnlee thank you for the update but at least on Mac it doesn't build anymore now:

$ make darwin
...
2024/06/04 09:38:13 [INFO] exec (timeout=0s): /opt/homebrew/bin/go build -o /Users/bijanchokoufenejad/repos/caddy-openapi/dist/caddy-amd6-darwin-aa93a88 -ldflags -w -s -trimpath -tags nobadger
# github.com/chukmunnlee/caddy-openapi
../util.go:81:30: r.Spec.ExtensionProps undefined (type *openapi3.T has no field or method ExtensionProps)
../util.go:86:33: r.PathItem.ExtensionProps undefined (type *openapi3.PathItem has no field or method ExtensionProps)
../util.go:110:27: oper.ExtensionProps undefined (type *openapi3.Operation has no field or method ExtensionProps)
../util.go:115:28: undefined: openapi3.ExtensionProps
2024/06/04 09:38:23 [INFO] Cleaning up temporary folder: /Users/bijanchokoufenejad/repos/caddy-openapi/buildenv_2024-06-04-0937.2118164889
2024/06/04 09:38:23 [FATAL] exit status 1
make: *** [darwin] Error 1

$ go version
go version go1.22.3 darwin/arm64