forked from jenkins-x/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Bayer <[email protected]>
- Loading branch information
Showing
43 changed files
with
507 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,50 @@ | ||
# Make does not offer a recursive wildcard function, so here's one: | ||
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) | ||
|
||
GO_DEPENDENCIES := $(call rwildcard,pkg/,*.go) $(call rwildcard,scm/,*.go) | ||
GO := GO111MODULE=on go | ||
GO_NOMOD := GO111MODULE=off go | ||
|
||
build: test | ||
|
||
test: | ||
go test ./... | ||
|
||
linux: build | ||
linux: build | ||
|
||
.PHONY: check | ||
check: fmt lint sec ## Runs Go format check as well as security checks | ||
|
||
get-fmt-deps: | ||
$(GO_NOMOD) get golang.org/x/tools/cmd/goimports | ||
|
||
.PHONY: importfmt | ||
importfmt: get-fmt-deps ## Checks the import format of the Go source files | ||
@echo "FORMATTING IMPORTS" | ||
@goimports -w $(GO_DEPENDENCIES) | ||
|
||
.PHONY: fmt ## Checks Go source files are formatted properly | ||
fmt: importfmt | ||
@echo "FORMATTING SOURCE" | ||
FORMATTED=`$(GO) fmt ./...` | ||
@([[ ! -z "$(FORMATTED)" ]] && printf "Fixed un-formatted files:\n$(FORMATTED)") || true | ||
|
||
GOLINT := $(GOPATH)/bin/golint | ||
$(GOLINT): | ||
$(GO_NOMOD) get -u golang.org/x/lint/golint | ||
|
||
.PHONY: lint | ||
lint: $(GOLINT) ## Runs 'go vet' anf 'go lint' | ||
@echo "VETTING" | ||
$(GO) vet ./... | ||
@echo "LINTING" | ||
$(GOLINT) -set_exit_status ./... | ||
|
||
GOSEC := $(GOPATH)/bin/gosec | ||
$(GOSEC): | ||
$(GO_NOMOD) get -u github.com/securego/gosec/cmd/gosec | ||
|
||
.PHONY: sec | ||
sec: $(GOSEC) ## Runs gosec to check for potential security issues in the Go source | ||
@echo "SECURITY SCANNING" | ||
$(GOSEC) -quiet -fmt=csv ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,5 +33,5 @@ pipelineConfig: | |
- name: test | ||
command: make | ||
args: | ||
- test | ||
- check test | ||
dir: /workspace/source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.