From e4602992ffbc465ea14bce5501cdbfc361fd8c96 Mon Sep 17 00:00:00 2001 From: xxj <346944475@qq.com> Date: Thu, 3 Dec 2020 01:44:58 +0800 Subject: [PATCH] Avoid embedding: Fix code samples (#106) Remove return clauses from methods that don't return anything and don't use a pointer to an interface. Co-authored-by: Abhinav Gupta --- style.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/style.md b/style.md index 4caa1ae1..a4ad5d51 100644 --- a/style.md +++ b/style.md @@ -1335,12 +1335,12 @@ type ConcreteList struct { // Add adds an entity to the list. func (l *ConcreteList) Add(e Entity) { - return l.list.Add(e) + l.list.Add(e) } // Remove removes an entity from the list. func (l *ConcreteList) Remove(e Entity) { - return l.list.Remove(e) + l.list.Remove(e) } ``` @@ -1390,17 +1390,17 @@ type ConcreteList struct { ```go // ConcreteList is a list of entities. type ConcreteList struct { - list *AbstractList + list AbstractList } // Add adds an entity to the list. func (l *ConcreteList) Add(e Entity) { - return l.list.Add(e) + l.list.Add(e) } // Remove removes an entity from the list. func (l *ConcreteList) Remove(e Entity) { - return l.list.Remove(e) + l.list.Remove(e) } ```