summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2021-11-18 01:33:06 +0000
committerGitHub <noreply@github.com>2021-11-18 09:33:06 +0800
commitc98dd7a3e0a08b1e890d6030dd51aae9dd45aaf9 (patch)
treee50b4bf9fc94e26d26d1f9709f4e8275eed60fc1 /modules
parentb01f6c1a8c9f358c297e0d1f4ee8696c9e25d5b2 (diff)
downloadgitea-c98dd7a3e0a08b1e890d6030dd51aae9dd45aaf9.tar.gz
gitea-c98dd7a3e0a08b1e890d6030dd51aae9dd45aaf9.zip
Remove unnecessary variable assignments (#17695)
* Remove unnecessary variable assignments As title * enable ineffassign Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r--modules/gitgraph/graph_test.go3
-rw-r--r--modules/nosql/manager_leveldb.go3
-rw-r--r--modules/web/middleware/binding.go2
3 files changed, 2 insertions, 6 deletions
diff --git a/modules/gitgraph/graph_test.go b/modules/gitgraph/graph_test.go
index c2726a731a..c805ff4647 100644
--- a/modules/gitgraph/graph_test.go
+++ b/modules/gitgraph/graph_test.go
@@ -55,11 +55,10 @@ func BenchmarkParseGlyphs(b *testing.B) {
parser.Reset()
tgBytes := []byte(testglyphs)
tg := tgBytes
- idx := bytes.Index(tg, []byte("\n"))
for i := 0; i < b.N; i++ {
parser.Reset()
tg = tgBytes
- idx = bytes.Index(tg, []byte("\n"))
+ idx := bytes.Index(tg, []byte("\n"))
for idx > 0 {
parser.ParseGlyphs(tg[:idx])
tg = tg[idx+1:]
diff --git a/modules/nosql/manager_leveldb.go b/modules/nosql/manager_leveldb.go
index 769d5002d0..eeb0cf74d9 100644
--- a/modules/nosql/manager_leveldb.go
+++ b/modules/nosql/manager_leveldb.go
@@ -48,13 +48,12 @@ func (m *Manager) GetLevelDB(connection string) (*leveldb.DB, error) {
return db.db, nil
}
- dataDir := connection
uri := ToLevelDBURI(connection)
db = &levelDBHolder{
name: []string{connection, uri.String()},
}
- dataDir = path.Join(uri.Host, uri.Path)
+ dataDir := path.Join(uri.Host, uri.Path)
opts := &opt.Options{}
for k, v := range uri.Query() {
switch replacer.Replace(strings.ToLower(k)) {
diff --git a/modules/web/middleware/binding.go b/modules/web/middleware/binding.go
index cbdb29b812..9b0b1d7784 100644
--- a/modules/web/middleware/binding.go
+++ b/modules/web/middleware/binding.go
@@ -93,11 +93,9 @@ func Validate(errs binding.Errors, data map[string]interface{}, f Form, l transl
AssignForm(f, data)
typ := reflect.TypeOf(f)
- val := reflect.ValueOf(f)
if typ.Kind() == reflect.Ptr {
typ = typ.Elem()
- val = val.Elem()
}
if field, ok := typ.FieldByName(errs[0].FieldNames[0]); ok {