Browse Source

Read file

renovate/configure
Yota Toyama 8 years ago
parent
commit
0e9d02300b
  1. 5
      examples/error.feature
  2. 9
      main.go

5
examples/error.feature

@ -3,3 +3,8 @@ Feature: Error
Given a file named "foo.md" with "" Given a file named "foo.md" with ""
When I run `linkcheck` When I run `linkcheck`
Then the exit status should be 1 Then the exit status should be 1
Scenario: Fail with a non-existent file
Given a file named "foo.md" with ""
When I run `linkcheck bar.md`
Then the exit status should be 1

9
main.go

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"io/ioutil"
"os" "os"
docopt "github.com/docopt/docopt-go" docopt "github.com/docopt/docopt-go"
@ -15,7 +16,13 @@ func main() {
} }
}() }()
getArgs() args := getArgs()
_, err := ioutil.ReadFile(args["<filename>"].(string))
if err != nil {
panic(err)
}
} }
func getArgs() map[string]interface{} { func getArgs() map[string]interface{} {

Loading…
Cancel
Save