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

Create sub-modules for examples and wrappers #67

Closed
wants to merge 4 commits into from
Closed

Create sub-modules for examples and wrappers #67

wants to merge 4 commits into from

Conversation

rs
Copy link
Owner

@rs rs commented Oct 3, 2018

No description provided.

wrapper/go.mod Outdated
@@ -0,0 +1,22 @@
module github.com/rs/cors/wrapper/gin
Copy link
Owner Author

Choose a reason for hiding this comment

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

@komuw: shouldn't this file be at wrapper/gin level?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rs agreed.
I have done that now.

@komuw
Copy link
Contributor

komuw commented Oct 4, 2018

@rs I do not know if you want one go.mod for all the examples(like I've done) or one per example directory?

@komuw komuw mentioned this pull request Oct 4, 2018
@rs
Copy link
Owner Author

rs commented Oct 5, 2018

When running go test in wrapper/gin, I still get this error:

go: finding golang.org/x/net v0.0.0-20181003013248-f5e5bdd77824
can't load package: package github.com/rs/cors/wrapper/gin: unknown import path "github.com/rs/cors/wrapper/gin": ambiguous import: found github.com/rs/cors/wrapper/gin in multiple modules:
	github.com/rs/cors/wrapper/gin (<redacted>/cors/wrapper/gin)
	github.com/rs/cors v1.5.0 (<redacted>/go/pkg/mod/github.com/rs/cors@v1.5.0/wrapper/gin)

How do you test this?

inside github.com/rs/cors/wrapper/gin , replace github.com/rs/cors with the
relative path to the co-located github.com/rs/cors package.
see: golang/go#27056
@komuw
Copy link
Contributor

komuw commented Oct 5, 2018

@rs
after this commit: 6cabe93

the commands:

go test -count=1 ./... && \
cd wrapper/gin && \
go test -count=1 ./... && \
cd ../..
ok  	github.com/rs/cors	0.004s
ok  	github.com/rs/cors/wrapper/gin	0.004s

now works.

However the command;

cd examples && \
go test -count=1 ./... && \
cd ..

doesn't succeed.
The only way I can make the last command succeed is if I remove;

cors "github.com/rs/cors/wrapper/gin"

which seems to indicate that maybe the replace directive: https://github.com/rs/cors/pull/67/files#diff-8d6f6299a802b70c5794f4ed12c66ce2R26
is not working.

To be honest, this has turned out quite harder than I thought it would.
I think(more like hoping), that the issue; golang/go#27056 is meant to address this.

I'll keep probing to see if I can get the examples folder to play cool

@komuw
Copy link
Contributor

komuw commented Oct 5, 2018

also: golang/go#27957

@komuw
Copy link
Contributor

komuw commented Oct 5, 2018

this investigation has led me to discover something else;
it seems like Go modules doesn't verify all replace directives.
I have filed; golang/go#28032 for that

@rs rs closed this Dec 22, 2021
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.

2 participants