summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-07-22 11:35:54 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2019-07-22 17:35:53 +0800
commitb0cd3b8ab9b174f11fd4db8737106be5caf9cc1c (patch)
tree357b210567a95a33667e9441062584abdd799951
parent9a965035f0e485b2f4b69b76441949c264499c2b (diff)
downloadgitea-b0cd3b8ab9b174f11fd4db8737106be5caf9cc1c.tar.gz
gitea-b0cd3b8ab9b174f11fd4db8737106be5caf9cc1c.zip
Fixed ineffectual assignments (#7555)
Don't assign values we never use.
-rw-r--r--models/git_diff.go2
-rw-r--r--routers/user/setting/security_twofa.go1
2 files changed, 1 insertions, 2 deletions
diff --git a/models/git_diff.go b/models/git_diff.go
index 2f48f1b6fa..518d543e7b 100644
--- a/models/git_diff.go
+++ b/models/git_diff.go
@@ -543,7 +543,7 @@ func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*D
// Get new file.
if strings.HasPrefix(line, cmdDiffHead) {
- middle := -1
+ var middle int
// Note: In case file name is surrounded by double quotes (it happens only in git-shell).
// e.g. diff --git "a/xxx" "b/xxx"
diff --git a/routers/user/setting/security_twofa.go b/routers/user/setting/security_twofa.go
index 6e3516dbba..5aa951a9ba 100644
--- a/routers/user/setting/security_twofa.go
+++ b/routers/user/setting/security_twofa.go
@@ -81,7 +81,6 @@ func twofaGenerateSecretAndQr(ctx *context.Context) bool {
// Filter unsafe character ':' in issuer
issuer := strings.Replace(setting.AppName+" ("+setting.Domain+")", ":", "", -1)
if otpKey == nil {
- err = nil // clear the error, in case the URL was invalid
otpKey, err = totp.Generate(totp.GenerateOpts{
SecretSize: 40,
Issuer: issuer,