-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
x/mod: expose API to do GOPRIVATE matching #38725
Comments
Seems like a good thing to have. Maybe in
where |
I might be inclined to use a different name, since these patterns are looser than our usual “module path patterns”: they implicitly apply to prefixes, and they support the full glob syntax instead of just Maybe |
My only thought on the matter is that the "patterns" parameter should go first, to match what people are used to from the standard library - look at |
Sure, CLs welcome. It should go into
That can land immediately, and we can tag a prerelease version if that's useful. We should update |
In retrospect I probably should have made an effort to put this in x/mod before copying... I can send a CL. |
Change https://golang.org/cl/239797 mentions this issue: |
Change https://golang.org/cl/240061 mentions this issue: |
In CL 239797, str.GlobsMatchPath was copied to golang.org/x/mod/module as MatchPrefixPatterns. This CL updates x/mod, switches calls to use the new function, and deletes the old function. For #38725 Change-Id: I7241032228b574aa539426a92d2f5aad9ee001e2 Reviewed-on: https://go-review.googlesource.com/c/go/+/240061 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
That is:
go/src/cmd/go/internal/str/path.go
Lines 54 to 96 in 863424b
go help module-private
does briefly mention the semantics:However, I don't think that's quite detailed enough to implement this from scratch, and it's still pretty tricky and prone to errors to do.
I realise that package pattern matching wasn't exposed as a library on purpose, to encourage tool authors to use
go list
instead. However, I don't think this falls under the same bucket since there's no way to do this via the go tool, and because GOPRIVATE matching should be a very cheap operation - it doesn't involve any disk or network I/O for example, unlike patterns likecmd/...
.The text was updated successfully, but these errors were encountered: