Skip to content

Commit 8847e54

Browse files
committed
Fix lint and add lint doc in README.md
1 parent 81f7d89 commit 8847e54

File tree

6 files changed

+8
-4
lines changed

6 files changed

+8
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ golang-design-patterns
44
A collection of design patterns implemented in golang.
55

66
Prefer to build use golang >= 1.18
7+
8+
Install [golangci-lint] (https://github.com/golangci/golangci-lint) for lint.

cmd/chain/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (p *ConcreteHandler2) handle(request int) {
3434

3535
// implementor 3
3636
type ConcreteHandler3 struct {
37-
successor Handler
37+
successor Handler //nolint:unused
3838
}
3939

4040
func (p *ConcreteHandler3) handle(request int) {

cmd/command/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ func main() {
2727
var ren1, ren2 MoveFileCommand
2828
ren2, list = list[len(list)-1], list[:len(list)-1]
2929
ren2.undo()
30-
ren1, list = list[len(list)-1], list[:len(list)-1]
30+
ren1, _ = list[len(list)-1], list[:len(list)-1]
3131
ren1.undo()
3232
}

cmd/composite/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func (p *CompositeGraphic) add(graphic Graphic) {
2222
p.childGraphics = append(p.childGraphics, graphic)
2323
}
2424

25+
//nolint:unused
2526
func (p *CompositeGraphic) remove(graphic Graphic) {
2627
new_list := []Graphic{}
2728
for _, obj := range p.childGraphics {

cmd/proxy/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func (p *Proxy) work() {
2929
} else {
3030
time.Sleep(1 * time.Second)
3131
fmt.Println("Sales Manager is busy")
32+
p.Sales.work()
3233
}
3334
}
3435

cmd/template_method/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ func (p *Template) templateMethod() {
2222
}
2323

2424
func (p IntList) modify_list() {
25-
for i, _ := range []int(p) {
25+
for i := range []int(p) {
2626
p[i] *= 2
2727
}
2828
}
2929

3030
func (p ByteList) modify_list() {
31-
for i, _ := range []byte(p) {
31+
for i := range []byte(p) {
3232
p[i]++
3333
}
3434
}

0 commit comments

Comments
 (0)