| 1 | //go:build testtools |
| 2 | // +build testtools |
| 3 | |
| 4 | package main |
| 5 | |
| 6 | import ( |
| 7 | "fmt" |
| 8 | "os" |
| 9 | ) |
| 10 | |
| 11 | func main() { |
| 12 | if len(os.Args) < 2 { |
| 13 | fmt.Fprintf(os.Stderr, "Need an argument") |
| 14 | os.Exit(2) |
| 15 | } |
| 16 | st, err := os.Stat(os.Args[1]) |
| 17 | if err != nil { |
| 18 | fmt.Fprintf(os.Stderr, "Failed to stat %q: %s", os.Args[1], err) |
| 19 | os.Exit(3) |
| 20 | } |
| 21 | mtime := st.ModTime() |
| 22 | fmt.Printf("%d.%09d", mtime.Unix(), mtime.Nanosecond()) |
| 23 | } |