Add go mod replace when proto changes happen
Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
		
							
								
								
									
										10
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Makefile
									
									
									
									
									
								
							| @@ -150,7 +150,7 @@ GOTEST ?= $(GO) test | |||||||
| OUTPUTDIR = $(join $(ROOTDIR), _output) | OUTPUTDIR = $(join $(ROOTDIR), _output) | ||||||
| CRIDIR=$(OUTPUTDIR)/cri | CRIDIR=$(OUTPUTDIR)/cri | ||||||
|  |  | ||||||
| .PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release static-release mandir install-man install-doc genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test | .PHONY: clean all AUTHORS build binaries test integration generate protos check-protos coverage ci check help install uninstall vendor release static-release mandir install-man install-doc genman install-cri-deps cri-release cri-cni-release cri-integration install-deps bin/cri-integration.test remove-replace clean-vendor | ||||||
| .DEFAULT: default | .DEFAULT: default | ||||||
|  |  | ||||||
| # Forcibly set the default goal to all, in case an include above brought in a rule definition. | # Forcibly set the default goal to all, in case an include above brought in a rule definition. | ||||||
| @@ -181,6 +181,8 @@ protos: bin/protoc-gen-go-fieldpath | |||||||
| 	@rm -rf ${TMPDIR} v2 | 	@rm -rf ${TMPDIR} v2 | ||||||
| 	go-fix-acronym -w -a '^Os' $(shell find api/ -name '*.pb.go') | 	go-fix-acronym -w -a '^Os' $(shell find api/ -name '*.pb.go') | ||||||
| 	go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ -name '*.pb.go') | 	go-fix-acronym -w -a '(Id|Io|Uuid|Os)$$' $(shell find api/ -name '*.pb.go') | ||||||
|  | 	@test -z "$$(git status --short | grep "api/next.pb.txt" | tee /dev/stderr)" || \ | ||||||
|  | 		$(GO) mod edit -replace=github.com/containerd/containerd/api=./api | ||||||
|  |  | ||||||
| check-protos: protos ## check if protobufs needs to be generated again | check-protos: protos ## check if protobufs needs to be generated again | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
| @@ -466,6 +468,10 @@ root-coverage: ## generate coverage profiles for unit tests that require root | |||||||
| 		fi; \ | 		fi; \ | ||||||
| 	done ) | 	done ) | ||||||
|  |  | ||||||
|  | remove-replace: | ||||||
|  | 	@echo "$(WHALE) $@" | ||||||
|  | 	@$(GO) mod edit -dropreplace=github.com/containerd/containerd/api | ||||||
|  |  | ||||||
| vendor: ## ensure all the go.mod/go.sum files are up-to-date including vendor/ directory | vendor: ## ensure all the go.mod/go.sum files are up-to-date including vendor/ directory | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
| 	@$(GO) mod tidy | 	@$(GO) mod tidy | ||||||
| @@ -484,6 +490,8 @@ verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date | |||||||
| 	@diff -r -u -q ${ROOTDIR} ${TMPDIR}/containerd | 	@diff -r -u -q ${ROOTDIR} ${TMPDIR}/containerd | ||||||
| 	@rm -rf ${TMPDIR} | 	@rm -rf ${TMPDIR} | ||||||
|  |  | ||||||
|  | clean-vendor: remove-replace vendor | ||||||
|  |  | ||||||
|  |  | ||||||
| help: ## this help | help: ## this help | ||||||
| 	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort | 	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Derek McGowan
					Derek McGowan