Skip to content

Instantly share code, notes, and snippets.

@maniankara
Last active May 30, 2019
Embed
What would you like to do?
Simple Golang snippet which checks for file availability on filesystem - Used in blog
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
err := filepath.Walk("/home/go", func(path string, info os.FileInfo, err error) error {
if err != nil {
fmt.Printf("Error", err)
return err
}
if info.Name() == "abc" {
fmt.Println("found: " + path)
}
return nil
})
if err != nil {
fmt.Printf("", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment