Skip to content

Commit 55f3dba

Browse files
committed
Add lint option to Makefile and fix lint issues
1 parent f8affc0 commit 55f3dba

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ Note: if you’d like to implement a new feature, please consider creating a fea
6767
* Run `gofmt` over your code to automatically resolve a lot of style issues. Most editors support this running automatically when saving a code file.
6868
* Run `go lint` and `go vet` on your code too to catch any other issues.
6969
* Follow this guide on some good practice and idioms for Go - https://github.com/golang/go/wiki/CodeReviewComments
70+
* To check for extra issues, install [golangci-lint](https://github.com/golangci/golangci-lint) and run `make lint` or `golangci-lint run`

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ else
1111
go test ./...
1212
endif
1313

14+
lint:
15+
golangci-lint run
16+
1417
compile: test
1518
ifeq ($(BUILD_IN_CONTAINER),1)
1619
$(GO_DOCKER_RUN) $(GOLANG_CONTAINER) go build -o /build_output/nginx-asg-sync

cmd/sync/aws.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ func (client *AWSClient) getInstancesOfAutoscalingGroup(group *autoscaling.Group
9191
return result, err
9292
}
9393
for _, res := range resp.Reservations {
94-
for _, ins := range res.Instances {
95-
result = append(result, ins)
96-
}
94+
result = append(result, res.Instances...)
9795
}
9896

9997
return result, nil

cmd/sync/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ func main() {
145145
func createAWSClient(region string) *AWSClient {
146146
httpClient := &http.Client{Timeout: connTimeoutInSecs * time.Second}
147147
cfg := &aws.Config{Region: aws.String(region), HTTPClient: httpClient}
148-
session := session.New(cfg)
148+
session, err := session.NewSession(cfg)
149+
150+
if err != nil {
151+
log.Printf("Error while creating AWS Client: %v", err)
152+
}
153+
149154
svcAutoscaling := autoscaling.New(session)
150155
svcEC2 := ec2.New(session)
151156
return NewAWSClient(svcEC2, svcAutoscaling)

0 commit comments

Comments
 (0)