Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kjk
Last active July 12, 2020 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjk/f3200e74ea0cb6cb456b2c973c7bd9ce to your computer and use it in GitHub Desktop.
Save kjk/f3200e74ea0cb6cb456b2c973c7bd9ce to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"os"
)
func main() {
// :show start
st, err := os.Stat("main.go")
if err != nil {
log.Fatalf("GetFileSize failed with '%s'\n", err)
}
fmt.Printf(`Name: %s
Size: %d
IsDir: %v
Mode: %x
ModTime: %s
OS info: %#v
`, st.Name(), st.Size(), st.IsDir(), st.Mode, st.ModTime(), st.Sys())
// :show end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment