-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This uses an external network dependency. Sigh.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This is thame as get.txt except that we use the -vcs flag | ||
# on gohack get. Until we can figure out better, this requires | ||
# access to the network. | ||
|
||
[!net] skip | ||
[!exec:git] skip | ||
env GOPROXY= | ||
|
||
cd repo | ||
go get rsc.io/quote@v1.5.2 | ||
env GOHACK=$WORK/gohack | ||
gohack get -vcs rsc.io/quote | ||
stdout '^rsc.io/quote => .*/gohack/rsc.io/quote$' | ||
! stderr .+ | ||
|
||
# Check that the replace statement is there. | ||
grep -count=1 '^replace rsc\.io/quote => .*/gohack/rsc.io/quote$' go.mod | ||
|
||
# Check that it's a git repository | ||
exists $WORK/gohack/rsc.io/quote/.git | ||
|
||
# Check that the source files have been copied. | ||
grep '^' $WORK/gohack/rsc.io/quote/quote.go | ||
|
||
# Check that we can compile the command OK. | ||
go install example.com/repo | ||
|
||
# Hack the package a bit and check that it doesn't compile | ||
# any more. | ||
cp ../bogus.go $WORK/gohack/rsc.io/quote/bogus.go | ||
! go install example.com/repo | ||
stderr 'found packages wrong \(bogus\.go\) and quote \(quote\.go\)' | ||
|
||
# Use git to reset the package. | ||
cd $WORK/gohack/rsc.io/quote | ||
exec git clean -xf | ||
|
||
# We should be able to compile it again. | ||
cd $WORK/repo | ||
go install | ||
|
||
-- repo/main.go -- | ||
|
||
package main | ||
import ( | ||
"fmt" | ||
"rsc.io/quote" | ||
) | ||
|
||
func main() { | ||
fmt.Println(quote.Glass()) | ||
} | ||
|
||
-- repo/go.mod -- | ||
module example.com/repo | ||
|
||
-- bogus.go -- | ||
|
||
package wrong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters