@kjk1/

gobook file get info

Go

No description

fork
loading
Files
  • main.go

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.4550030869161432","path":"main.go","file":{"path":"main.go","content":{"asEncoding":{"base64":"Ly8gbm8gcGxheWdyb3VuZApwYWNrYWdlIG1haW4KCmltcG9ydCAoCgkiZm10IgoJImxvZyIKCSJvcyIKKQoKLy8gOnNob3cgc3RhcnQKCmZ1bmMgbWFpbigpIHsKCXN0LCBlcnIgOj0gb3MuU3RhdCgibWFpbi5nbyIpCglpZiBlcnIgIT0gbmlsIHsKCQlsb2cuRmF0YWxmKCJHZXRGaWxlU2l6ZSBmYWlsZWQgd2l0aCAnJXMnXG4iLCBlcnIpCgl9CglmbXQuUHJpbnRmKGBOYW1lOiAlcwpTaXplOiAlZApJc0RpcjogJXYKTW9kZTogJXgKTW9kVGltZTogJXMKT1MgaW5mbzogJSN2CmAsIHN0Lk5hbWUoKSwgc3QuU2l6ZSgpLCBzdC5Jc0RpcigpLCBzdC5Nb2RlLCBzdC5Nb2RUaW1lKCksIHN0LlN5cygpKQp9CgovLyA6c2hvdyBlbmQ="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// no playground
package main

import (
	"fmt"
	"log"
	"os"
)

// :show start

func main() {
	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