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

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

View as plain text