...

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

Documentation: cmd/go/testdata/script

     1# Tests golang.org/issue/4773
     2
     3go list -json example/a
     4stdout 'case-insensitive import collision'
     5
     6! go build example/a
     7stderr 'case-insensitive import collision'
     8
     9# List files explicitly on command line, to encounter case-checking
    10# logic even on case-insensitive filesystems.
    11cp b/file.go b/FILE.go  # no-op on case-insensitive filesystems
    12! go list b/file.go b/FILE.go
    13stderr 'case-insensitive file name collision'
    14
    15mkdir a/Pkg  # no-op on case-insensitive filesystems
    16cp a/pkg/pkg.go a/Pkg/pkg.go  # no-op on case-insensitive filesystems
    17! go list example/a/pkg example/a/Pkg
    18
    19# Test that the path reported with an indirect import is correct.
    20cp b/file.go b/FILE.go
    21[case-sensitive] ! go build example/c
    22[case-sensitive] stderr '^package example/c\n\timports example/b: case-insensitive file name collision: "FILE.go" and "file.go"$'
    23
    24-- go.mod --
    25module example
    26
    27go 1.16
    28-- a/a.go --
    29package p
    30import (
    31	_ "example/a/pkg"
    32	_ "example/a/Pkg"
    33)
    34-- a/pkg/pkg.go --
    35package pkg
    36-- b/file.go --
    37package b
    38-- c/c.go --
    39package c
    40
    41import _ "example/b"

View as plain text