...

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

Documentation: cmd/go/testdata/script

     1# Test internal package errors are handled
     2cd testinternal3
     3go list .
     4stdout 'testinternal3'
     5
     6# Test internal cache
     7cd ../testinternal4
     8! go build testinternal4/p
     9stderr 'internal'
    10
    11# Test internal packages outside GOROOT are respected
    12cd ../testinternal2
    13env GO111MODULE=off
    14! go build -v .
    15stderr 'p\.go:3:8: use of internal package .*internal/w not allowed'
    16env GO111MODULE=''
    17
    18[compiler:gccgo] skip # gccgo does not have GOROOT
    19cd ../testinternal
    20! go build -v .
    21stderr 'p\.go:3:8: use of internal package net/http/internal not allowed'
    22
    23-- testinternal/go.mod --
    24module testinternal
    25
    26go 1.16
    27-- testinternal/p.go --
    28package p
    29
    30import _ "net/http/internal"
    31-- testinternal2/go.mod --
    32module testinternal2
    33
    34go 1.16
    35-- testinternal2/p.go --
    36package p
    37
    38import _ "./x/y/z/internal/w"
    39-- testinternal2/x/y/z/internal/w/w.go --
    40package w
    41-- testinternal3/go.mod --
    42module testinternal3
    43
    44go 1.16
    45-- testinternal3/t.go --
    46package t
    47
    48import _ "internal/does-not-exist"
    49-- testinternal4/go.mod --
    50module testinternal4
    51
    52go 1.16
    53-- testinternal4/p/p.go --
    54package p
    55
    56import (
    57	_ "testinternal4/q/internal/x"
    58	_ "testinternal4/q/j"
    59)
    60-- testinternal4/q/internal/x/x.go --
    61package x
    62-- testinternal4/q/j/j.go --
    63package j
    64
    65import _ "testinternal4/q/internal/x"

View as plain text