Skip to content

Instantly share code, notes, and snippets.

Created August 9, 2022 01:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
generate dotfiles install scripts
package main
import (
// go run script/setup.go > script/setup
// ./script/setup
func main() {
filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
if err != nil {
fmt.Fprintf(os.Stderr, "failed to access %q: %v\n", path, err)
return err
if info.IsDir() {
if info.Name() == ".git" || info.Name() == "script" {
return filepath.SkipDir
return nil
if info.Name() == "" {
return nil
dest := "$HOME/" + path
fmt.Printf("mkdir -p `dirname %q`\n", dest)
fmt.Printf("install -p %q %q\n", path, dest)
return nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment