@@ -10,10 +10,10 @@ import (
1010
1111// Config represents the CLI configuration
1212type Config struct {
13- Server ServerConfig `toml:"server"`
14- Defaults DefaultsConfig `toml:"defaults"`
15- Cache CacheConfig `toml:"cache"`
16- StatusAliases map [string ]string `toml:"status_aliases"`
13+ Server ServerConfig `toml:"server"`
14+ Defaults DefaultsConfig `toml:"defaults"`
15+ Cache CacheConfig `toml:"cache"`
16+ StatusAliases map [string ]string `toml:"status_aliases"`
1717}
1818
1919type ServerConfig struct {
@@ -107,27 +107,19 @@ func getGlobalConfigPath() string {
107107 return filepath .Join (home , ".config" , "ws" , "config.toml" )
108108}
109109
110- func getGlobalCachePath () string {
111- home , err := os .UserHomeDir ()
112- if err != nil {
113- return ""
114- }
115- return filepath .Join (home , ".cache" , "ws" )
116- }
117-
118110func saveGlobalConfig (config Config ) error {
119111 path := getGlobalConfigPath ()
120112 dir := filepath .Dir (path )
121113
122- if err := os .MkdirAll (dir , 0755 ); err != nil {
114+ if err := os .MkdirAll (dir , 0o750 ); err != nil {
123115 return fmt .Errorf ("failed to create config directory: %w" , err )
124116 }
125117
126118 f , err := os .Create (path )
127119 if err != nil {
128120 return fmt .Errorf ("failed to create config file: %w" , err )
129121 }
130- defer f .Close ()
122+ defer func () { _ = f .Close () } ()
131123
132124 encoder := toml .NewEncoder (f )
133125 return encoder .Encode (config )
@@ -138,7 +130,7 @@ func saveProjectConfig(config Config, path string) error {
138130 if err != nil {
139131 return fmt .Errorf ("failed to create config file: %w" , err )
140132 }
141- defer f .Close ()
133+ defer func () { _ = f .Close () } ()
142134
143135 encoder := toml .NewEncoder (f )
144136 return encoder .Encode (config )
0 commit comments