github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/get_dotfiles.txt (about) 1 env GO111MODULE=off 2 [short] skip 3 4 [!exec:git] skip 5 6 # Set up a benign repository and a repository with a dotfile name. 7 cd $WORK/_origin/foo 8 exec git init 9 exec git config user.name 'Nameless Gopher' 10 exec git config user.email 'nobody@golang.org' 11 exec git commit --allow-empty -m 'create master branch' 12 13 cd $WORK/_origin/.hidden 14 exec git init 15 exec git config user.name 'Nameless Gopher' 16 exec git config user.email 'nobody@golang.org' 17 exec git commit --allow-empty -m 'create master branch' 18 19 # Clone the empty repositories into GOPATH. 20 # This tells the Go command where to find them: it takes the place of a user's meta-tag redirector. 21 mkdir $GOPATH/src/example.com 22 cd $GOPATH/src/example.com 23 exec git clone $WORK/_origin/foo 24 exec git clone $WORK/_origin/.hidden 25 26 # Add a benign commit. 27 cd $WORK/_origin/foo 28 cp _ok/main.go main.go 29 exec git add main.go 30 exec git commit -m 'add ok' 31 32 # 'go get' should install the benign commit. 33 cd $GOPATH 34 go get -u example.com/foo 35 36 # Now sneak in an import of a dotfile path. 37 cd $WORK/_origin/.hidden 38 exec git add hidden.go 39 exec git commit -m 'nothing to see here, move along' 40 41 cd $WORK/_origin/foo 42 cp _sneaky/main.go main.go 43 exec git add main.go 44 exec git commit -m 'fix typo (heh heh heh)' 45 46 # 'go get -u' should refuse to download or update the dotfile-named repo. 47 cd $GOPATH/src/example.com/foo 48 ! go get -u example.com/foo 49 stderr 'leading dot' 50 ! exists example.com/.hidden/hidden.go 51 52 -- $WORK/_origin/foo/_ok/main.go -- 53 package main 54 55 func main() {} 56 57 -- $WORK/_origin/foo/_sneaky/main.go -- 58 package main 59 import _ "example.com/.hidden" 60 61 func main() {} 62 63 -- $WORK/_origin/.hidden/hidden.go -- 64 package hidden