From 43d0c94d6ea4b794e1ba6742aacee9b2fdea3e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Weisbarth?= Date: Fri, 15 Sep 2023 17:48:29 +0200 Subject: [PATCH] Revert "Try to live with dependency on `go.mod` for generated code." and apply to others This reverts commit 541bb4369a22f10f4d07829fb3394f6e4dceff34 but applies the same changes to other files as well. --- src/acceptance/assets/app/go_app/Makefile | 12 ++++++++++-- src/autoscaler/Makefile | 10 +++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/acceptance/assets/app/go_app/Makefile b/src/acceptance/assets/app/go_app/Makefile index 676d7c9d14..9fcad48bc8 100644 --- a/src/acceptance/assets/app/go_app/Makefile +++ b/src/acceptance/assets/app/go_app/Makefile @@ -1,9 +1,11 @@ .ONESHELL: SHELL := /bin/bash .SHELLFLAGS := -eu -o pipefail -c ${SHELLFLAGS} +aes_terminal_font_yellow := \e[38;2;255;255;0m +aes_terminal_reset := \e[0m # TODO: Do we need the next line? -MAKEFLAGS= +MAKEFLAGS = GO_VERSION = $(shell go version | sed --expression='s/^[^0-9.]*\([0-9.]*\).*/\1/') GO_DEPENDENCIES = $(shell find . -type f -name '*.go') @@ -32,7 +34,13 @@ app-fakes-files := $(wildcard ${app-fakes-dir}/*.go) .PHONY: generate-fakes generate-fakes: ${app-fakes-dir} ${app-fakes-files} -${app-fakes-dir} ${app-fakes-files} &: ./go.mod ./internal/generate.go ${openapi-specs-list} +${app-fakes-dir} ${app-fakes-files} &: ./internal/generate.go ${openapi-specs-list} + @echo -ne '${aes_terminal_font_yellow}' + @echo -e '⚠️ The client-fakes generated from the openapi-specification depend on\n' \ + 'the files ./go.mod and ./go.sum. This has not been reflected in this\n' \ + 'make-target to avoid cyclic dependencies because `go mod tidy`, which\n' \ + 'modifies both files, depends itself on the client-fakes.' + @echo -ne '${aes_terminal_reset}' go generate ./... diff --git a/src/autoscaler/Makefile b/src/autoscaler/Makefile index 61e8a4346d..60cff2e904 100644 --- a/src/autoscaler/Makefile +++ b/src/autoscaler/Makefile @@ -1,6 +1,8 @@ SHELL := /bin/bash .SHELLFLAGS := -eu -o pipefail -c MAKEFLAGS := -s +aes_terminal_font_yellow := \e[38;2;255;255;0m +aes_terminal_reset := \e[0m GO_VERSION = $(shell go version | sed --expression='s/^[^0-9.]*\([0-9.]*\).*/\1/') GO_DEPENDENCIES = $(shell find . -type f -name '*.go') @@ -29,7 +31,13 @@ app-fakes-files := $(wildcard ${app-fakes-dir}/*.go) .PHONY: generate-fakes generate-fakes: ${app-fakes-dir} ${app-fakes-files} -${app-fakes-dir} ${app-fakes-files} &: ./go.mod ./generate-fakes.go +${app-fakes-dir} ${app-fakes-files} &: ./generate-fakes.go + @echo -ne '${aes_terminal_font_yellow}' + @echo -e '⚠️ The client-fakes generated from the openapi-specification depend on\n' \ + 'the files ./go.mod and ./go.sum. This has not been reflected in this\n' \ + 'make-target to avoid cyclic dependencies because `go mod tidy`, which\n' \ + 'modifies both files, depends itself on the client-fakes.' + @echo -ne '${aes_terminal_reset}' @echo "# Generating counterfeits" mkdir -p '${app-fakes-dir}' COUNTERFEITER_NO_GENERATE_WARNING='true' go generate ./...