aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2022-07-31 22:16:40 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-01 10:44:52 +0200
commitaaf0a0c65673db4b94c0dc200d7394a192128da1 (patch)
tree44940936efff55b49a6d359d053f55c7ab824e4d /config/config.go
parent21dcd440f877192af128c00ca2acbabf68bb3ee3 (diff)
downloadaerc-aaf0a0c65673db4b94c0dc200d7394a192128da1.tar.gz
lint: apply new formatting rules
Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go29
1 files changed, 14 insertions, 15 deletions
diff --git a/config/config.go b/config/config.go
index 75519ab3..7e1261df 100644
--- a/config/config.go
+++ b/config/config.go
@@ -398,7 +398,7 @@ var searchDirs = buildDefaultDirs()
func installTemplate(root, name string) error {
var err error
if _, err = os.Stat(root); os.IsNotExist(err) {
- err = os.MkdirAll(root, 0755)
+ err = os.MkdirAll(root, 0o755)
if err != nil {
return err
}
@@ -413,7 +413,7 @@ func installTemplate(root, name string) error {
if err != nil {
return err
}
- err = ioutil.WriteFile(path.Join(root, name), data, 0644)
+ err = ioutil.WriteFile(path.Join(root, name), data, 0o644)
if err != nil {
return err
}
@@ -527,10 +527,9 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
if err := validateBorderChars(uiSection, &uiSubConfig); err != nil {
return err
}
- contextualUi :=
- UIConfigContext{
- UiConfig: uiSubConfig,
- }
+ contextualUi := UIConfigContext{
+ UiConfig: uiSubConfig,
+ }
var index int
if strings.Contains(sectionName, "~") {
@@ -922,7 +921,6 @@ func LoadBindingSection(sec *ini.Section) (*KeyBindings, error) {
}
func (config *AercConfig) LoadBinds(binds *ini.File, baseName string, baseGroup **KeyBindings) error {
-
if sec, err := binds.GetSection(baseName); err == nil {
binds, err := LoadBindingSection(sec)
if err != nil {
@@ -947,11 +945,10 @@ func (config *AercConfig) LoadBinds(binds *ini.File, baseName string, baseGroup
return err
}
- contextualBind :=
- BindingConfigContext{
- Bindings: binds,
- BindContext: baseName,
- }
+ contextualBind := BindingConfigContext{
+ Bindings: binds,
+ BindContext: baseName,
+ }
var index int
if strings.Contains(sectionName, "=") {
@@ -1006,7 +1003,7 @@ func checkConfigPerms(filename string) error {
perms := info.Mode().Perm()
// group or others have read access
- if perms&044 != 0 {
+ if perms&0o44 != 0 {
fmt.Fprintf(os.Stderr, "The file %v has too open permissions.\n", filename)
fmt.Fprintln(os.Stderr, "This is a security issue (it contains passwords).")
fmt.Fprintf(os.Stderr, "To fix it, run `chmod 600 %v`\n", filename)
@@ -1035,7 +1032,8 @@ func (ui *UIConfig) loadStyleSet(styleSetDirs []string) error {
}
func (config AercConfig) mergeContextualUi(baseUi UIConfig,
- contextType ContextType, s string) UIConfig {
+ contextType ContextType, s string,
+) UIConfig {
for _, contextualUi := range config.ContextualUis {
if contextualUi.ContextType != contextType {
continue
@@ -1078,7 +1076,8 @@ func (uiConfig UIConfig) GetStyleSelected(so StyleObject) tcell.Style {
}
func (uiConfig UIConfig) GetComposedStyle(base StyleObject,
- styles []StyleObject) tcell.Style {
+ styles []StyleObject,
+) tcell.Style {
return uiConfig.style.Compose(base, styles)
}