-
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.
do not use go list to find go.mod file (#56)
The go list command fails if the go.mod file isn't well formed (like for example one of the replace directives refers to a non-existent target). This can be a problem, so find the go.mod file by looking directly for it instead.
- Loading branch information
Showing
5 changed files
with
58 additions
and
17 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
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
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
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,2 @@ | ||
! gohack get nothing | ||
stderr 'cannot find main module: no go.mod file found in any parent directory' |
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,29 @@ | ||
cd repo | ||
go get rsc.io/[email protected] | ||
env GOHACK=$WORK/gohack | ||
gohack get rsc.io/quote | ||
stdout '^rsc.io/quote => .*/gohack/rsc.io/quote$' | ||
! stderr .+ | ||
|
||
exists $GOHACK/rsc.io/quote | ||
rm $GOHACK/rsc.io/quote | ||
|
||
gohack undo | ||
stdout '^dropped rsc\.io/quote$' | ||
! stderr .+ | ||
|
||
-- repo/main.go -- | ||
package main | ||
import ( | ||
"fmt" | ||
"rsc.io/quote" | ||
"rsc.io/sampler" | ||
) | ||
|
||
func main() { | ||
sampler.DefaultUserPrefs() | ||
fmt.Println(quote.Glass()) | ||
} | ||
|
||
-- repo/go.mod -- | ||
module example.com/repo |