60// and returns composed URL with needed username and password.
61// It also checks if given user has permission when remote address
62// is actually a local path.
63func (f MigrateRepo) ParseRemoteAddr(user *database.User) (string, error) { 64 remoteAddr := strings.TrimSpace(f.CloneAddr)
65
66 // Remote address can be HTTP/HTTPS/Git URL or local path.
52 Description string `json:"description" binding:"MaxSize(512)"`
53}
54
55func (f *MigrateRepo) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { 56 return validate(errs, ctx.Data, f, ctx.Locale)
57}
58
(Go's FAQ)[https://go.dev/doc/faq#methodsonvaluesorpointers] recommends that method receivers should be consistent. If some of the methods of the type must have pointer receivers, the rest should too, so the method set is consistent regardless of how the type is used. This is because value and pointer receivers have different method sets.
package main
type foo struct {
a int
}
func (f foo) a() {}
func (f *foo) b() {
f.a = 10
}
package main
type foo struct {
a int
}
func (f *foo) a() {}
func (f *foo) b() {
f.a = 10
}