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