The go command only applies replace directives from the main module's
go.mod file. In this example, replace directives in your module B would be
applied, but replace directives in A (or any other dependency) would be
ignored. This is important for avoiding conflicts that can't easily be
resolved (for example, you depend on X and Y, and they both depend on
incompatible forked versions of Z).

The command 'go list -m -json $modulepath' shows information about any
module you depend on. In the output, the Replace field will be set if the
module is replaced.

On Thu, Jul 29, 2021 at 9:54 PM Amit Saha <amitsaha...@gmail.com> wrote:

> Say, i have a module A (github.com/username/foo/v1)  with a replace of
> a third-party package in its go.mod:
>
> replace github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt
> v3.2.1+incompatible
>
> Now, i  require module A/v1 package from module A in my module B
> containing the main package:
>
>  require (
>         github.com/username/foo/v1
>  )
>
> I want to make sure that, in my module B, "github.com/golang-jwt/jwt
> v3.2.1" is pulled in.
>
> I could verify that using the https://github.com/Helcaraxan/gomod tool:
>
> $ ~/go/bin/gomod reveal | grep jwt
> 'github.com/dgrijalva/jwt-go' is replaced:
>    github.com/launchdarkly/ld-relay/v6 -> github.com/golang-jwt/jwt @
> v3.2.1+incompatible
>
> Is there a way to verify the above using one of the go mod or go
> build/list commands?
>
> Thanks,
> Amit.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/CANODV3kGLUnA0cz_NTBZnYL5%2BrO7rec4WD6FvBqz9ohfNLMMRw%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGCADbYE9mqCyBqGcC5AFF0xKZektLTM6Nw%3D6uOF%2BN4nHk_BSw%40mail.gmail.com.

Reply via email to