Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions cmd/goose/icons.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
package main

import (
_ "embed"
"log/slog"
"os"
"path/filepath"
)

// Embed icon files at compile time for better distribution
//
//go:embed icons/goose.png
var iconGoose []byte

//go:embed icons/popper.png
var iconPopper []byte

//go:embed icons/smiling-face.png
var iconSmiling []byte

//go:embed icons/lock.png
var iconLock []byte

//go:embed icons/warning.png
var iconWarning []byte
// Icon variables are defined in platform-specific files:
// - icons_windows.go: uses .ico files
// - icons_unix.go: uses .png files

Check failure on line 11 in cmd/goose/icons.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Comment should end in a period (godot)

// IconType represents different icon states

Check failure on line 13 in cmd/goose/icons.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Comment should end in a period (godot)
type IconType int

const (
Expand All @@ -36,7 +22,7 @@
IconLock // Authentication error
)

// getIcon returns the icon bytes for the given type

Check failure on line 25 in cmd/goose/icons.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Comment should end in a period (godot)
func getIcon(iconType IconType) []byte {
switch iconType {
case IconGoose:
Expand All @@ -57,7 +43,7 @@
}
}

// loadIconFromFile loads an icon from the filesystem (fallback if embed fails)

Check failure on line 46 in cmd/goose/icons.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Comment should end in a period (godot)
func loadIconFromFile(filename string) []byte {
iconPath := filepath.Join("icons", filename)
data, err := os.ReadFile(iconPath)
Expand Down
Binary file added cmd/goose/icons/goose.ico
Binary file not shown.
Binary file added cmd/goose/icons/popper.ico
Binary file not shown.
Binary file added cmd/goose/icons/smiling-face.ico
Binary file not shown.
Binary file added cmd/goose/icons/warning.ico
Binary file not shown.
24 changes: 24 additions & 0 deletions cmd/goose/icons_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//go:build !windows

package main

import (
_ "embed"
)

// Embed PNG files for Unix-like systems (macOS, Linux)
//
//go:embed icons/goose.png
var iconGoose []byte

//go:embed icons/popper.png
var iconPopper []byte

//go:embed icons/smiling-face.png
var iconSmiling []byte

//go:embed icons/lock.png
var iconLock []byte

//go:embed icons/warning.png
var iconWarning []byte
24 changes: 24 additions & 0 deletions cmd/goose/icons_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//go:build windows

package main

import (
_ "embed"
)

// Embed Windows ICO files at compile time
//
//go:embed icons/goose.ico
var iconGoose []byte

//go:embed icons/popper.ico
var iconPopper []byte

//go:embed icons/smiling-face.ico
var iconSmiling []byte

//go:embed icons/warning.ico
var iconWarning []byte

// lock.ico not yet created, using warning as fallback
var iconLock = iconWarning
Loading