fix: empty alias crash
All checks were successful
/ deploy (push) Successful in 54s

This commit is contained in:
ange 2025-04-05 10:01:55 +00:00
parent d8ecbef86e
commit 2b5867840b
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
2 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
ssh /static/ssh
pgp /static/pgp.asc
termux.sh https://git.gmoker.com/ange/termux/raw/branch/main/install.sh
dotfiles.sh
archinstall.sh
dotfiles.sh https://git.gmoker.com/ange/.dotfiles
arch.sh https://git.gmoker.com/ange/arch

View File

@ -1,7 +1,6 @@
package main
import (
"bufio"
"log"
"os"
"strings"
@ -10,16 +9,17 @@ import (
var ALIASES map[string]string
func generateAliases() {
f, err := os.Open("aliases.txt")
f, err := os.ReadFile("aliases.txt")
if err != nil {
log.Fatal(err)
}
sc := bufio.NewScanner(f)
ALIASES = make(map[string]string)
for sc.Scan() {
sp := strings.Fields(sc.Text())
for l := range strings.SplitSeq(string(f), "\n") {
sp := strings.Fields(l)
if len(sp) == 2 {
ALIASES[sp[0]] = sp[1]
}
}
}