From 79dfe7b85dd53478b35969e1a176d0d58c93a77d Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 9 Dec 2023 21:16:12 -0800 Subject: [PATCH] fix remaining compilation errors --- apgbpal.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/apgbpal.go b/apgbpal.go index 4f1ca4e..7b9126f 100644 --- a/apgbpal.go +++ b/apgbpal.go @@ -30,7 +30,7 @@ func HexByteAt(str string, index int) (byte, error) { return byte(big), nil } -func ParseRGBA(str string) RGBA, error { +func ParseRGBA(str string) (RGBA, error) { s := strings.TrimSpace(str) s = strings.ToLower(s) s, _ = strings.CutPrefix(s, "#") @@ -83,7 +83,8 @@ func MustParseBGPal(strs []string) BGPal { } var ret BGPal for i := 0; i < 4; i++ { - ret[i], err := ParseRGBA(strs[i]) + var err error + ret[i], err = ParseRGBA(strs[i]) if err != nil { log.Fatalf("MustParseBGPal can't parse at %d: %v", i, err) } @@ -120,7 +121,8 @@ func MustParseOBJPal(strs []string) OBJPal { } var ret OBJPal for i := 0; i < 3; i++ { - ret[i], err := ParseRGBA(strs[i]) + var err error + ret[i], err = ParseRGBA(strs[i]) if err != nil { log.Fatalf("MustParseOBJPal can't parse at %d: %v", i, err) } @@ -149,16 +151,20 @@ func (a APGBPal) Bytes() [56]byte { } func main() { - f, err := os.OpenFile("test.pal", O_WRONLY|O_CREATE|O_EXCL, 0644) + f, err := os.OpenFile( + "test.pal", + os.O_WRONLY|os.O_CREATE|os.O_EXCL, + 0644) if err != nil { log.Fatalf("can't create test.pal: %v", err) } aUpPal := APGBPal{ BG: MustParseBGPal([]string{"ffffff", "ff8484", "943a3a", "000000"}), - OBJ0: MustParseObjPal([]string{"7bff31", "008400", "000000"}), - OBJ1: MustParseObjPal([]string{"63a5ff", "0000ff", "000000"}), + OBJ0: MustParseOBJPal([]string{"7bff31", "008400", "000000"}), + OBJ1: MustParseOBJPal([]string{"63a5ff", "0000ff", "000000"}), } - n, err := f.Write(aUpPal.Bytes()[:]) + palb := aUpPal.Bytes() + n, err := f.Write(palb[:]) if err != nil { log.Fatalf("can't save test.pal: %v", err) }