Skip to content

Commit

Permalink
Use golangci-lint (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
superbrothers authored Nov 8, 2020
1 parent 86bbe29 commit fd6d175
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: make lint
- run: make test
- run: make dist
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
GORELEASER_BIN := bin/goreleaser
GORELEASER := $(TOOLS_DIR)/$(GORELEASER_BIN)
GOLANGCI_LINT_BIN := bin/golangci-lint
GOLANGCI_LINT := $(TOOLS_DIR)/$(GOLANGCI_LINT_BIN)

$(GORELEASER): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR) && $(GO) build -o $(GORELEASER_BIN) github.com/goreleaser/goreleaser

$(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR) && $(GO) build -o $(GOLANGCI_LINT_BIN) github.com/golangci/golangci-lint/cmd/golangci-lint


.PHONY: build-cross
build-cross: $(GORELEASER)
$(GORELEASER) build --snapshot --rm-dist
Expand All @@ -25,8 +31,12 @@ vet:
fmt:
$(GO) fmt ./...

.PHONY: lint
lint: $(GOLANGCI_LINT) vet fmt
$(GOLANGCI_LINT) run

.PHONY: test
test: vet fmt
test:
$(GO) test -v ./...

.PHONY: dist
Expand Down
2 changes: 1 addition & 1 deletion cmd/ksort/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

func init() {
klog.InitFlags(flag.CommandLine)
flag.Set("logtostderr", "true")
_ = flag.Set("logtostderr", "true")
}

func main() {
Expand Down
1 change: 1 addition & 0 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ go 1.15

require (
github.com/goreleaser/goreleaser v0.145.0
github.com/golangci/golangci-lint v1.32.0
)
Loading

0 comments on commit fd6d175

Please sign in to comment.