...

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

Documentation: cmd/go/testdata/script

     1# Setup
     2env GO111MODULE=off
     3mkdir $WORK/tmp/testdata/src/xtestonly
     4cp f.go $WORK/tmp/testdata/src/xtestonly/f.go
     5cp f_test.go $WORK/tmp/testdata/src/xtestonly/f_test.go
     6env GOPATH=$WORK/tmp/testdata
     7cd $WORK
     8
     9# Check output of go list to ensure no duplicates
    10go list xtestonly ./tmp/testdata/src/xtestonly/...
    11cmp stdout $WORK/gopath/src/wantstdout
    12
    13-- wantstdout --
    14xtestonly
    15-- f.go --
    16package xtestonly
    17
    18func F() int { return 42 }
    19-- f_test.go --
    20package xtestonly_test
    21
    22import (
    23	"testing"
    24	"xtestonly"
    25)
    26
    27func TestF(t *testing.T) {
    28	if x := xtestonly.F(); x != 42 {
    29		t.Errorf("f.F() = %d, want 42", x)
    30	}
    31}

View as plain text