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

accept replacements with branches of github forks #51

Merged
merged 2 commits into from
Feb 26, 2021

Conversation

mohammed90
Copy link
Member

Closes #50

@francislavoie
Copy link
Member

Have you tested that this works?

xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive

Actual usecase from someone else who ran into this right after I reported it 😅

I'll try it out myself later when I get to my env, but impl looks about right to me.

@mohammed90
Copy link
Member Author

Have you tested that this works?

xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive

Actual usecase from someone else who ran into this right after I reported it 😅

I'll try it out myself later when I get to my env, but impl looks about right to me.

Works:

~/projects/caddyserver/xcaddy/cmd/xcaddy ./xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive --
output ./caddy-fwdproxy
2021/02/26 17:18:17 [INFO] Temporary folder: /Users/mohammed/projects/caddyserver/xcaddy/cmd/xcaddy/buildenv_2021-02-26-1718.581327436
2021/02/26 17:18:17 [INFO] Writing main module: /Users/mohammed/projects/caddyserver/xcaddy/cmd/xcaddy/buildenv_2021-02-26-1718.581327436/main.go
2021/02/26 17:18:17 [INFO] Initializing Go module
2021/02/26 17:18:17 [INFO] exec (timeout=10s): /usr/local/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
	go mod tidy
2021/02/26 17:18:17 [INFO] Replace github.com/caddyserver/forwardproxy => github.com/klzgrad/forwardproxy@naive
2021/02/26 17:18:17 [INFO] exec (timeout=10s): /usr/local/bin/go mod edit -replace github.com/caddyserver/forwardproxy=github.com/klzgrad/forwardproxy@naive
2021/02/26 17:18:17 [INFO] Pinning versions
2021/02/26 17:18:17 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v github.com/caddyserver/caddy/v2
go get: added github.com/caddyserver/caddy/v2 v2.3.0
2021/02/26 17:18:24 [INFO] Build environment ready
2021/02/26 17:18:24 [INFO] Building Caddy
2021/02/26 17:18:24 [INFO] exec (timeout=0s): /usr/local/bin/go mod tidy
go: downloading github.com/klzgrad/forwardproxy v0.0.0-20210120121422-9b4a5a242bd6
go: found github.com/caddyserver/forwardproxy in github.com/caddyserver/forwardproxy v0.0.0-00010101000000-000000000000
2021/02/26 17:18:30 [INFO] exec (timeout=0s): /usr/local/bin/go build -o /Users/mohammed/projects/caddyserver/xcaddy/cmd/xcaddy/caddy-fwdproxy -ldflags -w -s -trimpath
2021/02/26 17:19:06 [INFO] Build complete: ./caddy-fwdproxy
2021/02/26 17:19:06 [INFO] Cleaning up temporary folder: /Users/mohammed/projects/caddyserver/xcaddy/cmd/xcaddy/buildenv_2021-02-26-1718.581327436

 ~/projects/caddyserver/xcaddy/cmd/xcaddy ./caddy-fwdproxy list-modules                                                                                                               
admin.api.load
...
http.handlers.forward_proxy

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this patch! Double-check my logic on my one nit; otherwise this LGTM.

cmd/xcaddy/main.go Outdated Show resolved Hide resolved
If the replacement path starts with a `.`, then the path is definitely not absolute.
@mohammed90 mohammed90 merged commit 83bc5a7 into master Feb 26, 2021
@mohammed90 mohammed90 deleted the accept-github-fork branch February 26, 2021 22:49
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 this pull request may close these issues.

Can't do module replacement with github forks
3 participants