github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/Makefile (about)

     1  #
     2  # github.com/khulnasoft/cli
     3  #
     4  
     5  # Sets the name of the company that produced the windows binary.
     6  PACKAGER_NAME ?=
     7  
     8  # The repository doesn't have a go.mod, but "go list", and "gotestsum"
     9  # expect to be run from a module.
    10  GO111MODULE=auto
    11  export GO111MODULE
    12  
    13  all: binary
    14  
    15  _:=$(shell ./scripts/warn-outside-container $(MAKECMDGOALS))
    16  
    17  .PHONY: dev
    18  dev: ## start a build container in interactive mode for in-container development
    19  	@if [ -n "${DISABLE_WARN_OUTSIDE_CONTAINER}" ]; then \
    20  		echo "you are already in the dev container"; \
    21  	else \
    22  		$(MAKE) -f docker.Makefile dev; \
    23  	fi
    24  
    25  .PHONY: shell
    26  shell: dev ## alias for dev
    27  
    28  .PHONY: clean
    29  clean: ## remove build artifacts
    30  	rm -rf ./build/* man/man[1-9] docs/yaml
    31  
    32  .PHONY: test
    33  test: test-unit ## run tests
    34  
    35  .PHONY: test-unit
    36  test-unit: ## run unit tests, to change the output format use: GOTESTSUM_FORMAT=(dots|short|standard-quiet|short-verbose|standard-verbose) make test-unit
    37  	gotestsum -- $${TESTDIRS:-$(shell go list ./... | grep -vE '/vendor/|/e2e/')} $(TESTFLAGS)
    38  
    39  .PHONY: test-coverage
    40  test-coverage: ## run test coverage
    41  	mkdir -p $(CURDIR)/build/coverage
    42  	gotestsum -- $(shell go list ./... | grep -vE '/vendor/|/e2e/') -coverprofile=$(CURDIR)/build/coverage/coverage.txt
    43  
    44  .PHONY: lint
    45  lint: ## run all the lint tools
    46  	golangci-lint run
    47  
    48  .PHONY: shellcheck
    49  shellcheck: ## run shellcheck validation
    50  	find scripts/ contrib/completion/bash -type f | grep -v scripts/winresources | grep -v '.*.ps1' | xargs shellcheck
    51  
    52  .PHONY: fmt
    53  fmt: ## run gofumpt (if present) or gofmt
    54  	@if command -v gofumpt > /dev/null; then \
    55  		gofumpt -w -d -lang=1.21 . ; \
    56  	else \
    57  		go list -f {{.Dir}} ./... | xargs gofmt -w -s -d ; \
    58  	fi
    59  
    60  .PHONY: binary
    61  binary: ## build executable for Linux
    62  	./scripts/build/binary
    63  
    64  .PHONY: dynbinary
    65  dynbinary: ## build dynamically linked binary
    66  	GO_LINKMODE=dynamic ./scripts/build/binary
    67  
    68  .PHONY: plugins
    69  plugins: ## build example CLI plugins
    70  	./scripts/build/plugins
    71  
    72  .PHONY: vendor
    73  vendor: ## update vendor with go modules
    74  	rm -rf vendor
    75  	./scripts/vendor update
    76  
    77  .PHONY: validate-vendor
    78  validate-vendor: ## validate vendor
    79  	./scripts/vendor validate
    80  
    81  .PHONY: mod-outdated
    82  mod-outdated: ## check outdated dependencies
    83  	./scripts/vendor outdated
    84  
    85  .PHONY: authors
    86  authors: ## generate AUTHORS file from git history
    87  	scripts/docs/generate-authors.sh
    88  
    89  .PHONY: manpages
    90  manpages: ## generate man pages from go source and markdown
    91  	scripts/docs/generate-man.sh
    92  
    93  .PHONY: mddocs
    94  mddocs: ## generate markdown files from go source
    95  	scripts/docs/generate-md.sh
    96  
    97  .PHONY: yamldocs
    98  yamldocs: ## generate documentation YAML files consumed by docs repo
    99  	scripts/docs/generate-yaml.sh
   100  
   101  .PHONY: help
   102  help: ## print this help
   103  	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)