github.com/scottcagno/storage@v1.8.0/pkg/util/hide.go (about) 1 //go:build !windows 2 // +build !windows 3 4 package util 5 6 import ( 7 "os" 8 "path/filepath" 9 "strings" 10 ) 11 12 func HideFile(filename string) error { 13 if !strings.HasPrefix(filepath.Base(filename), ".") { 14 err := os.Rename(filename, "."+filename) 15 if err != nil { 16 return err 17 } 18 } 19 return nil 20 }