Use pointer instead of struct
This commit is contained in:
parent
853477e54a
commit
6d8f38d749
18 changed files with 187 additions and 142 deletions
|
|
@ -10,7 +10,7 @@ const (
|
|||
DelegatedDomainSuffix = "srs.p0m.fr."
|
||||
)
|
||||
|
||||
func (student Student) MyDelegatedDomain() string {
|
||||
func (student *Student) MyDelegatedDomain() string {
|
||||
if student.DelegatedDomain != nil {
|
||||
return *student.DelegatedDomain
|
||||
} else {
|
||||
|
|
@ -18,11 +18,11 @@ func (student Student) MyDelegatedDomain() string {
|
|||
}
|
||||
}
|
||||
|
||||
func (student Student) DefaultAssociatedDomain() string {
|
||||
func (student *Student) DefaultAssociatedDomain() string {
|
||||
return fmt.Sprintf("%s.%s", strings.Trim(strings.Replace(student.Login, "_", "-", -1), "-_"), AssociatedDomainSuffix)
|
||||
}
|
||||
|
||||
func (student Student) MyAssociatedDomain() string {
|
||||
func (student *Student) MyAssociatedDomain() string {
|
||||
if student.AssociatedDomain != nil {
|
||||
return *student.AssociatedDomain
|
||||
} else {
|
||||
|
|
@ -30,7 +30,7 @@ func (student Student) MyAssociatedDomain() string {
|
|||
}
|
||||
}
|
||||
|
||||
func (student Student) GetAssociatedDomains() (ds []string) {
|
||||
func (student *Student) GetAssociatedDomains() (ds []string) {
|
||||
defdn := student.DefaultAssociatedDomain()
|
||||
ds = append(ds, defdn)
|
||||
|
||||
|
|
|
|||
Reference in a new issue