new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
24
Task/Check-that-file-exists/Go/check-that-file-exists.go
Normal file
24
Task/Check-that-file-exists/Go/check-that-file-exists.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func printStat(p string) {
|
||||
switch i, err := os.Stat(p); {
|
||||
case err != nil:
|
||||
fmt.Println(err)
|
||||
case i.IsDir():
|
||||
fmt.Println(p, "is a directory")
|
||||
default:
|
||||
fmt.Println(p, "is a file")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
printStat("input.txt")
|
||||
printStat("/input.txt")
|
||||
printStat("docs")
|
||||
printStat("/docs")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue