github.com/yoheimuta/protolint@v0.49.8-0.20240515023657-4ecaebb7575d/Makefile (about)

     1  ## test/all runs all related tests.
     2  test/all: test/lint test
     3  
     4  ## test runs `go test`
     5  test:
     6  	go test -v -p 2 -count 1 -timeout 240s -race ./...
     7  
     8  ## test runs `go test -run $(RUN)`
     9  test/run:
    10  	go test -v -p 2 -count 1 -timeout 240s -race ./... -run $(RUN)
    11  
    12  ## test/lint runs linter
    13  test/lint:
    14  	# checks the coding style.
    15  	(! gofmt -s -d `find . -name vendor -prune -type f -o -name '*.go'` | grep '^')
    16  	# checks the import format.
    17  	(! goimports -l `find . -name vendor -prune -type f -o -name '*.go'` | grep -v 'pb.go' | grep 'go')
    18  	# checks the error the compiler can't find.
    19  	go vet ./...
    20  	# checks shadowed variables.
    21  	go vet -vettool=$(which shadow) ./...
    22  	# checks no used assigned value.
    23  	ineffassign ./...
    24  	# checks not to ignore the error.
    25  	errcheck ./...
    26  	# checks unused global variables and constants.
    27  	varcheck ./...
    28  	# checks dispensable type conversions.
    29  	unconvert -v ./...
    30  
    31  ## dev/install/dep installs depenencies required for development.
    32  dev/install/dep:
    33  	sh ./.github/install_dep.sh
    34  
    35  ## dev/build/proto builds proto files under the _proto directory.
    36  dev/build/proto:
    37  	protoc -I _proto _proto/*.proto --go_out=plugins=grpc:internal/addon/plugin/proto
    38  
    39  ## ARG is command arguments.
    40  ARG=lint _example/proto
    41  
    42  ## run/cmd/protolint runs protolint with ARG
    43  run/cmd/protolint:
    44  	go run cmd/protolint/main.go $(ARG)
    45  
    46  ## run/cmd/protolint/exampleconfig runs protolint with ARG under _example/config
    47  run/cmd/protolint/exampleconfig:
    48  	cd _example/config && go run ../../cmd/protolint/main.go $(ARG)
    49  
    50  ## build/cmd/protolint builds protolint
    51  build/cmd/protolint:
    52  	go build \
    53  		-ldflags "-X github.com/yoheimuta/protolint/internal/cmd.version=`git describe --tags --abbrev=0` -X github.com/yoheimuta/protolint/internal/cmd.revision=`git rev-parse --short HEAD`" \
    54  		-o protolint \
    55  		cmd/protolint/main.go
    56  
    57  ## build/example/plugin builds a plugin
    58  build/example/plugin:
    59  	go build -o plugin_example _example/plugin/main.go
    60  
    61  ## build/cmd/protoc-gen-protolint builds protoc-gen-protolint
    62  build/cmd/protoc-gen-protolint:
    63  	go build \
    64  		-ldflags "-X github.com/yoheimuta/protolint/internal/cmd/protocgenprotolint.version=`git describe --tags --abbrev=0` -X github.com/yoheimuta/protolint/internal/cmd/protocgenprotolint.revision=`git rev-parse --short HEAD`" \
    65  		-o protoc-gen-protolint \
    66  		cmd/protoc-gen-protolint/main.go