...

Text file src/cmd/go/testdata/script/work_sync_check_multiple_paths_once.txt

Documentation: cmd/go/testdata/script

     1# Test that checkMultiplePaths reports errors exactly once in a workspace with
     2# multiple modules, even though it is called once per workspace module.
     3#
     4# example.com/a and example.com/b are both replaced by ../shared (which
     5# canonicalizes to the same path in workspace mode), triggering a "used for
     6# two different module paths" error. With three workspace modules the check
     7# is called three times; the error should appear in stderr exactly once.
     8
     9go work sync
    10stderr -count=1 'used for two different module paths'
    11
    12-- go.work --
    13go 1.18
    14
    15use (
    16	./m
    17	./n
    18	./o
    19)
    20
    21-- m/go.mod --
    22module example.com/m
    23
    24go 1.18
    25
    26require example.com/a v1.0.0
    27
    28replace example.com/a v1.0.0 => ../shared
    29
    30-- m/m.go --
    31package m
    32
    33-- n/go.mod --
    34module example.com/n
    35
    36go 1.18
    37
    38require example.com/b v1.0.0
    39
    40replace example.com/b v1.0.0 => ../shared
    41
    42-- n/n.go --
    43package n
    44
    45-- o/go.mod --
    46module example.com/o
    47
    48go 1.18
    49
    50-- o/o.go --
    51package o
    52
    53-- shared/go.mod --
    54module example.com/shared
    55
    56go 1.18

View as plain text