Swap ioutil to non-deprecated alternatives + clean up pre-commit errors

This commit is contained in:
David Dworken
2022-11-27 11:59:06 -08:00
parent 369e7ec8ea
commit 35444bf56e
14 changed files with 60 additions and 53 deletions

View File

@ -116,14 +116,20 @@ func touchFile(p string) {
}
func configureZshrc(homedir string) {
f, err := os.OpenFile(path.Join(homedir, ".zshrc"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
checkError(err)
defer f.Close()
_, err = f.WriteString(`export HISTFILE=~/.zsh_history
zshrcHistConfig := `export HISTFILE=~/.zsh_history
export HISTSIZE=10000
export SAVEHIST=1000
setopt SHARE_HISTORY
`)
`
dat, err := os.ReadFile(path.Join(homedir, ".zshrc"))
checkError(err)
if strings.Contains(string(dat), zshrcHistConfig) {
return
}
f, err := os.OpenFile(path.Join(homedir, ".zshrc"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
checkError(err)
defer f.Close()
_, err = f.WriteString(zshrcHistConfig)
checkError(err)
}