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

xcaddy build failed ctx.AppIsConfigured undefined #13

Closed
cowsay opened this issue Oct 2, 2023 · 4 comments · Fixed by #14
Closed

xcaddy build failed ctx.AppIsConfigured undefined #13

cowsay opened this issue Oct 2, 2023 · 4 comments · Fixed by #14

Comments

@cowsay
Copy link
Contributor

cowsay commented Oct 2, 2023

Tried to build xcaddy with modcaddy

xcaddy build --with github.com/gaukas/clienthellod/modcaddy

Got this:

go: downloading github.com/googleapis/enterprise-certificate-proxy v0.2.5
go: downloading cloud.google.com/go/compute v1.20.1
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
2023/10/02 20:58:39 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /root/4/caddy -ldflags -w -s -trimpath
# github.com/gaukas/clienthellod/modcaddy/listener
/root/.go/pkg/mod/github.com/gaukas/clienthellod@v0.4.0/modcaddy/listener/listener.go:65:10: ctx.AppIsConfigured undefined (type caddy.Context has no field or method AppIsConfigured)
# github.com/gaukas/clienthellod/modcaddy/handler
/root/.go/pkg/mod/github.com/gaukas/clienthellod@v0.4.0/modcaddy/handler/handler.go:53:10: ctx.AppIsConfigured undefined (type caddy.Context has no field or method AppIsConfigured)
2023/10/02 20:58:40 [INFO] Cleaning up temporary folder: /tmp/buildenv_2023-10-02-2058.860729220
2023/10/02 20:58:40 [FATAL] exit status 1

What can be wrong?

@gaukas
Copy link
Owner

gaukas commented Oct 2, 2023

It could be a Caddy version problem.

Could you please try again with github.com/caddyserver/caddy/v2 v2.6.4?

I might need some time to look into this issue. It seems that they renamed the function to AppIfConfigured in v2.7.0:
caddyserver/caddy#4893
caddyserver/caddy#5397

@gaukas
Copy link
Owner

gaukas commented Oct 2, 2023

Or, a PR is very much welcome if it worked with just the function name changed.

mholt: Great; yeah, I can 99% guarantee that nobody else is using this function.

caddyserver/caddy#5397 (review)

@cowsay
Copy link
Contributor Author

cowsay commented Oct 2, 2023

Yes, managed to build this with rename and type check fix (xcaddy build v2.6.4 also worked)

@gaukas
Copy link
Owner

gaukas commented Oct 2, 2023

Thanks for the PR! I left some suggestions and comments for passing the CI and reducing redundancy, if you'd love to. Or I can do a push, either way.

@gaukas gaukas closed this as completed in #14 Oct 3, 2023
gaukas added a commit that referenced this issue Oct 3, 2023
* fix/rename AppIsConfigured

* fix: broken dependency and code redundancy

- Update dependency to their latest
- Combined App configure check with assignment

* fix: go runner version

Bump up go test runner version to Go 1.20 to be consistent with go.mod.

I am actually surprised that go.mod specifying Go 1.20 does not immediately fail on all older version Go.

* fix: quotation mark around go-version

* fix: breaking go build ./...

---------

Co-authored-by: Gaukas Wang <i@gauk.as>
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

Successfully merging a pull request may close this issue.

2 participants