internal/gamepaddb: rename template variable for consistency, fix

initialism
This commit is contained in:
Kenny Goodin 2024-03-27 11:18:44 -04:00
parent c47aa9ee7f
commit 466f0c000c

View File

@ -63,7 +63,7 @@ import (
_ "embed" _ "embed"
) )
//go:embed gamecontrollerdb_{{.Platform}}.txt //go:embed gamecontrollerdb_{{.FileNameSuffix}}.txt
var controllerBytes []byte var controllerBytes []byte
//go:embed gamecontrollerdb_glfw.txt //go:embed gamecontrollerdb_glfw.txt
var glfwControllerBytes []byte var glfwControllerBytes []byte
@ -122,7 +122,7 @@ func run() error {
} }
for sdlName, platform := range supported { for sdlName, platform := range supported {
controllerDb, ok := controllerDBs[sdlName] controllerDB, ok := controllerDBs[sdlName]
if !ok { if !ok {
return fmt.Errorf("failed to find controller db for platform %s in gamecontrollerdb_txt", sdlName) return fmt.Errorf("failed to find controller db for platform %s in gamecontrollerdb_txt", sdlName)
} }
@ -133,9 +133,9 @@ func run() error {
return fmt.Errorf("failed to open file: %v", err) return fmt.Errorf("failed to open file: %v", err)
} }
defer txtFile.Close() defer txtFile.Close()
written, err := txtFile.Write(controllerDb) written, err := txtFile.Write(controllerDB)
if err != nil { if err != nil {
return fmt.Errorf("failed to write controller db for %s, expected to write %d bytes, wrote %d: %v", sdlName, len(controllerDb), written, err) return fmt.Errorf("failed to write controller db for %s, expected to write %d bytes, wrote %d: %v", sdlName, len(controllerDB), written, err)
} }
path := fmt.Sprintf("db_%s.go", platform.filenameSuffix) path := fmt.Sprintf("db_%s.go", platform.filenameSuffix)
@ -154,12 +154,12 @@ func run() error {
License string License string
DoNotEdit string DoNotEdit string
BuildConstraints string BuildConstraints string
Platform string FileNameSuffix string
}{ }{
License: license, License: license,
DoNotEdit: doNotEdit, DoNotEdit: doNotEdit,
BuildConstraints: platform.buildConstraints, BuildConstraints: platform.buildConstraints,
Platform: platform.filenameSuffix, FileNameSuffix: platform.filenameSuffix,
}) })
if err != nil { if err != nil {
return err return err