summaryrefslogtreecommitdiffstats
path: root/modules/options
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-01-20 18:46:10 +0100
committerGitHub <noreply@github.com>2022-01-20 18:46:10 +0100
commit54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch)
tree1be12fb072625c1b896b9d72f7912b018aad502b /modules/options
parent1d98d205f5825f40110e6628b61a97c91ac7f72d (diff)
downloadgitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.tar.gz
gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.zip
format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Diffstat (limited to 'modules/options')
-rw-r--r--modules/options/dynamic.go10
-rw-r--r--modules/options/static.go14
2 files changed, 6 insertions, 18 deletions
diff --git a/modules/options/dynamic.go b/modules/options/dynamic.go
index 78b0450d9b..e1b9353c33 100644
--- a/modules/options/dynamic.go
+++ b/modules/options/dynamic.go
@@ -17,9 +17,7 @@ import (
"code.gitea.io/gitea/modules/util"
)
-var (
- directories = make(directorySet)
-)
+var directories = make(directorySet)
// Dir returns all files from static or custom directory.
func Dir(name string) ([]string, error) {
@@ -27,9 +25,7 @@ func Dir(name string) ([]string, error) {
return directories.Get(name), nil
}
- var (
- result []string
- )
+ var result []string
customDir := path.Join(setting.CustomPath, "options", name)
@@ -39,7 +35,6 @@ func Dir(name string) ([]string, error) {
}
if isDir {
files, err := util.StatDir(customDir, true)
-
if err != nil {
return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
}
@@ -55,7 +50,6 @@ func Dir(name string) ([]string, error) {
}
if isDir {
files, err := util.StatDir(staticDir, true)
-
if err != nil {
return []string{}, fmt.Errorf("Failed to read static directory. %v", err)
}
diff --git a/modules/options/static.go b/modules/options/static.go
index afe32216d3..5b61e58f8f 100644
--- a/modules/options/static.go
+++ b/modules/options/static.go
@@ -18,9 +18,7 @@ import (
"code.gitea.io/gitea/modules/util"
)
-var (
- directories = make(directorySet)
-)
+var directories = make(directorySet)
// Dir returns all files from bindata or custom directory.
func Dir(name string) ([]string, error) {
@@ -28,9 +26,7 @@ func Dir(name string) ([]string, error) {
return directories.Get(name), nil
}
- var (
- result []string
- )
+ var result []string
customDir := path.Join(setting.CustomPath, "options", name)
isDir, err := util.IsDir(customDir)
@@ -39,7 +35,6 @@ func Dir(name string) ([]string, error) {
}
if isDir {
files, err := util.StatDir(customDir, true)
-
if err != nil {
return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
}
@@ -48,7 +43,6 @@ func Dir(name string) ([]string, error) {
}
files, err := AssetDir(name)
-
if err != nil {
return []string{}, fmt.Errorf("Failed to read embedded directory. %v", err)
}
@@ -69,7 +63,7 @@ func AssetDir(dirName string) ([]string, error) {
if err != nil {
return nil, err
}
- var results = make([]string, 0, len(files))
+ results := make([]string, 0, len(files))
for _, file := range files {
results = append(results, file.Name())
}
@@ -133,7 +127,7 @@ func Asset(name string) ([]byte, error) {
func AssetNames() []string {
realFS := Assets.(vfsgen۰FS)
- var results = make([]string, 0, len(realFS))
+ results := make([]string, 0, len(realFS))
for k := range realFS {
results = append(results, k[1:])
}