mirror of https://github.com/gogs/gogs.git
fix lint error
parent
bef68aed7a
commit
6e823fa2b2
|
@ -792,13 +792,13 @@ func (s *UsersStore) GetMailableEmailsByUsernames(ctx context.Context, usernames
|
|||
// IsUsernameUsed returns true if the given username has been used other than
|
||||
// the excluded user (a non-positive ID effectively meaning check against all
|
||||
// users).
|
||||
func (s *UsersStore) IsUsernameUsed(ctx context.Context, username string, excludeUserId int64) bool {
|
||||
func (s *UsersStore) IsUsernameUsed(ctx context.Context, username string, excludeUserID int64) bool {
|
||||
if username == "" {
|
||||
return false
|
||||
}
|
||||
return s.db.WithContext(ctx).
|
||||
Select("id").
|
||||
Where("lower_name = ? AND id != ?", strings.ToLower(username), excludeUserId).
|
||||
Where("lower_name = ? AND id != ?", strings.ToLower(username), excludeUserID).
|
||||
First(&User{}).
|
||||
Error != gorm.ErrRecordNotFound
|
||||
}
|
||||
|
@ -1425,8 +1425,8 @@ func (u *User) IsFollowing(followID int64) bool {
|
|||
//
|
||||
// TODO(unknwon): This is also used in templates, which should be fixed by
|
||||
// having a dedicated type `template.User`.
|
||||
func (u *User) IsUserOrgOwner(orgId int64) bool {
|
||||
return IsOrganizationOwner(orgId, u.ID)
|
||||
func (u *User) IsUserOrgOwner(orgID int64) bool {
|
||||
return IsOrganizationOwner(orgID, u.ID)
|
||||
}
|
||||
|
||||
// IsPublicMember returns true if the user has public membership of the given
|
||||
|
@ -1434,8 +1434,8 @@ func (u *User) IsUserOrgOwner(orgId int64) bool {
|
|||
//
|
||||
// TODO(unknwon): This is also used in templates, which should be fixed by
|
||||
// having a dedicated type `template.User`.
|
||||
func (u *User) IsPublicMember(orgId int64) bool {
|
||||
return IsPublicMembership(orgId, u.ID)
|
||||
func (u *User) IsPublicMember(orgID int64) bool {
|
||||
return IsPublicMembership(orgID, u.ID)
|
||||
}
|
||||
|
||||
// GetOrganizationCount returns the count of organization membership that the
|
||||
|
|
|
@ -146,7 +146,7 @@ func (*Sender) Send(from string, to []string, msg io.WriterTo) error {
|
|||
}
|
||||
|
||||
if err = client.Hello(hostname); err != nil {
|
||||
return fmt.Errorf("Hello: %v", err)
|
||||
return fmt.Errorf("hello: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,28 +173,28 @@ func (*Sender) Send(from string, to []string, msg io.WriterTo) error {
|
|||
|
||||
if auth != nil {
|
||||
if err = client.Auth(auth); err != nil {
|
||||
return fmt.Errorf("Auth: %v", err)
|
||||
return fmt.Errorf("auth: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err = client.Mail(from); err != nil {
|
||||
return fmt.Errorf("Mail: %v", err)
|
||||
return fmt.Errorf("mail: %v", err)
|
||||
}
|
||||
|
||||
for _, rec := range to {
|
||||
if err = client.Rcpt(rec); err != nil {
|
||||
return fmt.Errorf("Rcpt: %v", err)
|
||||
return fmt.Errorf("rcpt: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
w, err := client.Data()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Data: %v", err)
|
||||
return fmt.Errorf("data: %v", err)
|
||||
} else if _, err = msg.WriteTo(w); err != nil {
|
||||
return fmt.Errorf("WriteTo: %v", err)
|
||||
return fmt.Errorf("write to: %v", err)
|
||||
} else if err = w.Close(); err != nil {
|
||||
return fmt.Errorf("Close: %v", err)
|
||||
return fmt.Errorf("close: %v", err)
|
||||
}
|
||||
|
||||
return client.Quit()
|
||||
|
|
|
@ -44,7 +44,7 @@ type MigrateRepo struct {
|
|||
CloneAddr string `json:"clone_addr" binding:"Required"`
|
||||
AuthUsername string `json:"auth_username"`
|
||||
AuthPassword string `json:"auth_password"`
|
||||
Uid int64 `json:"uid" binding:"Required"`
|
||||
UID int64 `json:"uid" binding:"Required"`
|
||||
RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
Mirror bool `json:"mirror"`
|
||||
Private bool `json:"private"`
|
||||
|
|
|
@ -95,13 +95,13 @@ type Settings struct {
|
|||
UserAgent string
|
||||
ConnectTimeout time.Duration
|
||||
ReadWriteTimeout time.Duration
|
||||
TlsClientConfig *tls.Config
|
||||
TLSClientConfig *tls.Config
|
||||
Proxy func(*http.Request) (*url.URL, error)
|
||||
Transport http.RoundTripper
|
||||
EnableCookie bool
|
||||
}
|
||||
|
||||
// HttpRequest provides more useful methods for requesting one url than http.Request.
|
||||
// Request provides more useful methods for requesting a URL than http.Request.
|
||||
type Request struct {
|
||||
url string
|
||||
req *http.Request
|
||||
|
@ -112,7 +112,7 @@ type Request struct {
|
|||
body []byte
|
||||
}
|
||||
|
||||
// Change request settings
|
||||
// Setting changes the request settings
|
||||
func (r *Request) Setting(setting Settings) *Request {
|
||||
r.setting = setting
|
||||
return r
|
||||
|
@ -151,7 +151,7 @@ func (r *Request) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *Re
|
|||
|
||||
// SetTLSClientConfig sets tls connection configurations if visiting https url.
|
||||
func (r *Request) SetTLSClientConfig(config *tls.Config) *Request {
|
||||
r.setting.TlsClientConfig = config
|
||||
r.setting.TLSClientConfig = config
|
||||
return r
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ func (r *Request) getResponse() (*http.Response, error) {
|
|||
if trans == nil {
|
||||
// create default transport
|
||||
trans = &http.Transport{
|
||||
TLSClientConfig: r.setting.TlsClientConfig,
|
||||
TLSClientConfig: r.setting.TLSClientConfig,
|
||||
Proxy: r.setting.Proxy,
|
||||
DialContext: TimeoutDialer(r.setting.ConnectTimeout, r.setting.ReadWriteTimeout),
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ func (r *Request) getResponse() (*http.Response, error) {
|
|||
// if r.transport is *http.Transport then set the settings.
|
||||
if t, ok := trans.(*http.Transport); ok {
|
||||
if t.TLSClientConfig == nil {
|
||||
t.TLSClientConfig = r.setting.TlsClientConfig
|
||||
t.TLSClientConfig = r.setting.TLSClientConfig
|
||||
}
|
||||
if t.Proxy == nil {
|
||||
t.Proxy = r.setting.Proxy
|
||||
|
|
|
@ -208,8 +208,8 @@ func Migrate(c *context.APIContext, f form.MigrateRepo) {
|
|||
ctxUser := c.User
|
||||
// Not equal means context user is an organization,
|
||||
// or is another user/organization if current user is admin.
|
||||
if f.Uid != ctxUser.ID {
|
||||
org, err := database.Handle.Users().GetByID(c.Req.Context(), f.Uid)
|
||||
if f.UID != ctxUser.ID {
|
||||
org, err := database.Handle.Users().GetByID(c.Req.Context(), f.UID)
|
||||
if err != nil {
|
||||
if database.IsErrUserNotExist(err) {
|
||||
c.ErrorStatus(http.StatusUnprocessableEntity, err)
|
||||
|
|
|
@ -162,7 +162,7 @@ func Migrate(c *context.Context) {
|
|||
func MigratePost(c *context.Context, f form.MigrateRepo) {
|
||||
c.Data["Title"] = c.Tr("new_migrate")
|
||||
|
||||
ctxUser := checkContextUser(c, f.Uid)
|
||||
ctxUser := checkContextUser(c, f.UID)
|
||||
if c.Written() {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue