Golang os.SameFile() and os.Stat() functions example
package os
Golang os.SameFile() and os.Stat() functions usage example
package main
import (
"fmt"
"os"
)
func main() {
inStat, _ := os.Stat("in.txt")
outStat, _ := os.Stat("out.txt")
same := os.SameFile(inStat, outStat)
fmt.Println("The files are same : ", same)
}
Sample output :
The files are same : false
References :
Advertisement
Something interesting
Tutorials
+17k Golang : Capture stdout of a child process and act according to the result
+9.1k Golang : Handle sub domain with Gin
+9.4k Golang : Qt Yes No and Quit message box example
+5.4k Golang : fmt.Println prints out empty data from struct
+9k Golang : Inject/embed Javascript before sending out to browser example
+9.9k Golang : Sort and reverse sort a slice of integers
+11.2k Golang : Fix - does not implement sort.Interface (missing Len method)
+6.1k nginx : force all pages to be SSL
+29.4k Golang : JQuery AJAX post data to server and send data back to client example
+12k Golang : Clean formatting/indenting or pretty print JSON result
+5.8k Unix/Linux : How to test user agents blocked successfully ?
+5.7k Golang : Struct field tags and what is their purpose?