github.com/go-email-validator/go-email-validator@v0.0.0-20230409163946-b8b9e6a0552e/Makefile (about)

     1  go.build:
     2  	go build
     3  
     4  GO_TEST=go test ./pkg/...
     5  COVERAGE_UNIT_FILE="coverage.unit.out"
     6  COVERAGE_FILE="coverage.out"
     7  COVERAGE_TMP_FILE="coverage.out.tmp"
     8  MOCK_PATTERN=mock_.*.go
     9  
    10  GOROOT=$(shell go env GOROOT)
    11  
    12  go.test.unit:
    13  	$(GO_TEST) -race -covermode=atomic -coverprofile=$(COVERAGE_TMP_FILE)
    14  	rm $(COVERAGE_UNIT_FILE) || true
    15  	cat $(COVERAGE_TMP_FILE) | grep -v $(MOCK_PATTERN) > $(COVERAGE_UNIT_FILE)
    16  	rm $(COVERAGE_TMP_FILE) || true
    17  
    18  go.test:
    19  	$(GO_TEST) -race -covermode=atomic -func -coverprofile=$(COVERAGE_TMP_FILE)
    20  	rm $(COVERAGE_FILE) || true
    21  	cat $(COVERAGE_TMP_FILE) | grep -v $(MOCK_PATTERN) > $(COVERAGE_FILE)
    22  	rm $(COVERAGE_TMP_FILE) || true
    23  
    24  go.mocks: go.mocks.isntall go.mocks.gen
    25  
    26  go.mocks.isntall:
    27  	go get github.com/golang/mock/mockgen
    28  
    29  go.mocks.gen:
    30  	mockgen -source=test/mock/net/interface.go -destination=test/mock/net/conn.go --package=mocknet
    31  	mockgen -source=pkg/ev/evcache/evcache.go -destination=test/mock/ev/evcache/evcache.go --package=mockevcache
    32  	mockgen -source=pkg/ev/evsmtp/smtpclient/interface.go -destination=test/mock/ev/evsmtp/smtpclient/interface.go --package=mocksmtpclient
    33  	mockgen -source=pkg/ev/evsmtp/smtp.go -destination=pkg/ev/evsmtp/mock_smtp.go --package=evsmtp # https://github.com/golang/mock/issues/352
    34  	mockgen -source=pkg/ev/validator.go -destination=test/mock/ev/validator.go --package=mockev
    35  
    36  # wait https://github.com/golang/mock/issues/510
    37  go.mocks.nets:
    38  	mockgen -source=$(GOROOT)/go1.15.6/src/net/net.go -destination=test/mock/net/Conn.go --package=mocknet
    39  
    40  go.lint:
    41  	golint ./... | grep -v vendor/
    42  
    43  GO_COVER=go tool cover -func=$(COVERAGE_FILE)
    44  go.cover:
    45  	$(GO_COVER)
    46  
    47  go.cover.full: go.test go.cover
    48  
    49  go.cover.total:
    50  	$(GO_COVER) | grep total | awk '{print substr($$3, 1, length($$3)-1)}'
    51  
    52  # make act ARGS="-s CODECOV_TOKEN=..."
    53  act.build:
    54  	docker build -t act-node-slim build/act/
    55  act.run:
    56  	act -P ubuntu-latest=act-node-slim:latest $(ARGS)
    57  
    58  act: act.build act.run
    59  
    60  install.lint:
    61      curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0
    62  
    63  mod.update: mod.update.main mod.update.as-email-verifier.adapter
    64  
    65  mod.update.main:
    66  	go mod tidy
    67  
    68  mod.update.as-email-verifier.adapter:
    69  	cd pkg/presentation/as-email-verifier/adapter && \
    70  	go mod tidy
    71  
    72  # Mount own self in go path
    73  LIBRARY_PATH := $(GOROOT)/src$(GITHUB_VENDOR)
    74  
    75  mount.for_adapter: umount.for_adapter
    76  	rm -fr $(LIBRARY_PATH)
    77  	mkdir -p $(LIBRARY_PATH)
    78  	sudo mount -Br ~/go/src/github.com/go-email-validator/ $(LIBRARY_PATH)
    79  
    80  umount.for_adapter:
    81  	sudo umount $(LIBRARY_PATH) -q | exit 0
    82  
    83  
    84  test.run.proxy:
    85  	docker run --name proxy -dit --rm -p 1080:1080 -e 'SSS_USERNAME=username' -e 'SSS_PASSWORD=password' dijedodol/simple-socks5-server