3
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -71,6 +71,9 @@ jobs:
 | 
				
			|||||||
      - name: Run Kubernetes tests
 | 
					      - name: Run Kubernetes tests
 | 
				
			||||||
        run: ./scripts/test-k8s.sh
 | 
					        run: ./scripts/test-k8s.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Run linter
 | 
				
			||||||
 | 
					        run: make lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Ensure proto generation doesn't depend on external packages.
 | 
					      # Ensure proto generation doesn't depend on external packages.
 | 
				
			||||||
      - name: Verify proto
 | 
					      - name: Verify proto
 | 
				
			||||||
        run: make verify-proto
 | 
					        run: make verify-proto
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										45
									
								
								.golangci.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								.golangci.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
				
			|||||||
 | 
					run:
 | 
				
			||||||
 | 
					    skip-dirs:
 | 
				
			||||||
 | 
					        - vendor
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					linters-settings:
 | 
				
			||||||
 | 
					    golint:
 | 
				
			||||||
 | 
					        min-confidence: 0.1
 | 
				
			||||||
 | 
					    goimports:
 | 
				
			||||||
 | 
					        local-prefixes: github.com/dexidp/dex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					linters:
 | 
				
			||||||
 | 
					    enable-all: true
 | 
				
			||||||
 | 
					    disable:
 | 
				
			||||||
 | 
					        - funlen
 | 
				
			||||||
 | 
					        - maligned
 | 
				
			||||||
 | 
					        - wsl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # TODO: fix me
 | 
				
			||||||
 | 
					        - unused
 | 
				
			||||||
 | 
					        - structcheck
 | 
				
			||||||
 | 
					        - stylecheck
 | 
				
			||||||
 | 
					        - deadcode
 | 
				
			||||||
 | 
					        - misspell
 | 
				
			||||||
 | 
					        - unparam
 | 
				
			||||||
 | 
					        - goimports
 | 
				
			||||||
 | 
					        - golint
 | 
				
			||||||
 | 
					        - whitespace
 | 
				
			||||||
 | 
					        - goconst
 | 
				
			||||||
 | 
					        - unconvert
 | 
				
			||||||
 | 
					        - bodyclose
 | 
				
			||||||
 | 
					        - staticcheck
 | 
				
			||||||
 | 
					        - nakedret
 | 
				
			||||||
 | 
					        - ineffassign
 | 
				
			||||||
 | 
					        - errcheck
 | 
				
			||||||
 | 
					        - gosec
 | 
				
			||||||
 | 
					        - gochecknoinits
 | 
				
			||||||
 | 
					        - gochecknoglobals
 | 
				
			||||||
 | 
					        - prealloc
 | 
				
			||||||
 | 
					        - scopelint
 | 
				
			||||||
 | 
					        - lll
 | 
				
			||||||
 | 
					        - dupl
 | 
				
			||||||
 | 
					        - gocritic
 | 
				
			||||||
 | 
					        - gocyclo
 | 
				
			||||||
 | 
					        - gocognit
 | 
				
			||||||
 | 
					        - godox
 | 
				
			||||||
							
								
								
									
										28
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								Makefile
									
									
									
									
									
								
							@@ -2,7 +2,6 @@ PROJ=dex
 | 
				
			|||||||
ORG_PATH=github.com/dexidp
 | 
					ORG_PATH=github.com/dexidp
 | 
				
			||||||
REPO_PATH=$(ORG_PATH)/$(PROJ)
 | 
					REPO_PATH=$(ORG_PATH)/$(PROJ)
 | 
				
			||||||
export PATH := $(PWD)/bin:$(PATH)
 | 
					export PATH := $(PWD)/bin:$(PATH)
 | 
				
			||||||
THIS_DIRECTORY:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
VERSION ?= $(shell ./scripts/git-version)
 | 
					VERSION ?= $(shell ./scripts/git-version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,6 +17,9 @@ export GOBIN=$(PWD)/bin
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
LD_FLAGS="-w -X $(REPO_PATH)/version.Version=$(VERSION)"
 | 
					LD_FLAGS="-w -X $(REPO_PATH)/version.Version=$(VERSION)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Dependency versions
 | 
				
			||||||
 | 
					GOLANGCI_VERSION = 1.21.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build: bin/dex bin/example-app bin/grpc-client
 | 
					build: bin/dex bin/example-app bin/grpc-client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bin/dex:
 | 
					bin/dex:
 | 
				
			||||||
@@ -45,14 +47,19 @@ test:
 | 
				
			|||||||
testrace:
 | 
					testrace:
 | 
				
			||||||
	@go test -v --race ./...
 | 
						@go test -v --race ./...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vet:
 | 
					bin/golangci-lint: bin/golangci-lint-${GOLANGCI_VERSION}
 | 
				
			||||||
	@go vet ./...
 | 
						@ln -sf golangci-lint-${GOLANGCI_VERSION} bin/golangci-lint
 | 
				
			||||||
 | 
					bin/golangci-lint-${GOLANGCI_VERSION}:
 | 
				
			||||||
 | 
						curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION}
 | 
				
			||||||
 | 
						@mv bin/golangci-lint $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fmt:
 | 
					.PHONY: lint
 | 
				
			||||||
	@./scripts/gofmt ./...
 | 
					lint: bin/golangci-lint ## Run linter
 | 
				
			||||||
 | 
						bin/golangci-lint run
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lint: bin/golint
 | 
					.PHONY: fix
 | 
				
			||||||
	@./bin/golint -set_exit_status $(shell go list ./...)
 | 
					fix: bin/golangci-lint ## Fix lint violations
 | 
				
			||||||
 | 
						bin/golangci-lint run --fix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: docker-image
 | 
					.PHONY: docker-image
 | 
				
			||||||
docker-image:
 | 
					docker-image:
 | 
				
			||||||
@@ -73,14 +80,11 @@ bin/protoc: scripts/get-protoc
 | 
				
			|||||||
bin/protoc-gen-go:
 | 
					bin/protoc-gen-go:
 | 
				
			||||||
	@go install -v $(REPO_PATH)/vendor/github.com/golang/protobuf/protoc-gen-go
 | 
						@go install -v $(REPO_PATH)/vendor/github.com/golang/protobuf/protoc-gen-go
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bin/golint:
 | 
					 | 
				
			||||||
	@go install -v $(THIS_DIRECTORY)/vendor/golang.org/x/lint/golint
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	@rm -rf bin/
 | 
						@rm -rf bin/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testall: testrace vet fmt lint
 | 
					testall: testrace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FORCE:
 | 
					FORCE:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: test testrace vet fmt lint testall
 | 
					.PHONY: test testrace testall
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
#!/bin/bash -e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
result=$( go fmt $@ )
 | 
					 | 
				
			||||||
if [[ $result != "" ]]; then
 | 
					 | 
				
			||||||
    >&2 echo "The following files are not formatted correctly: $result"
 | 
					 | 
				
			||||||
    exit 1
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user