Skip to content

Commit

Permalink
chore(testing): Remove panic when GOPATH does not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoshiki41 committed Jan 18, 2018
1 parent 9b53730 commit 0fb3cc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
3 changes: 0 additions & 3 deletions internal/m3u8/m3u8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ func readTestData(fileName string) *os.File {
const testDir = "github.com/yyoshiki41/go-radiko/testdata"

GOPATH := os.Getenv("GOPATH")
if GOPATH == "" {
panic("$GOPATH is empty.")
}
f, err := os.Open(filepath.Join(GOPATH, "src", testDir, fileName))
if err != nil {
panic(err)
Expand Down
8 changes: 2 additions & 6 deletions testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const (
var (
outsideJP bool

goPath string
testdataDir string
)

Expand All @@ -26,11 +25,8 @@ func init() {
flag.BoolVar(&outsideJP, "outjp", false, "Skip tests if outside Japan.")
flag.Parse()

goPath := os.Getenv("GOPATH")
if goPath == "" {
panic("$GOPATH is empty.")
}
testdataDir = filepath.Join(goPath, "src", "github.com/yyoshiki41/go-radiko", "testdata")
GOPATH := os.Getenv("GOPATH")
testdataDir = filepath.Join(GOPATH, "src", "github.com/yyoshiki41/go-radiko", "testdata")
}

// For skipping tests.
Expand Down

0 comments on commit 0fb3cc5

Please sign in to comment.